-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #524 from donny-wong/v2.4.3
V2.4.3
- Loading branch information
Showing
10 changed files
with
124 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions
10
server/autotest_server/tests/testers/py/fixtures/sample_tests_skip.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import pytest | ||
|
||
|
||
def add_one(x): | ||
return x + 1 | ||
|
||
|
||
@pytest.mark.skip | ||
def test_add_one(): | ||
assert add_one(1) == 2 |
6 changes: 6 additions & 0 deletions
6
server/autotest_server/tests/testers/py/fixtures/sample_tests_success.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def add_one(x): | ||
return x + 1 | ||
|
||
|
||
def test_add_one(): | ||
assert add_one(1) == 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from ....testers.specs import TestSpecs | ||
from ....testers.py.py_tester import PyTester | ||
|
||
|
||
def test_success(request, monkeypatch) -> None: | ||
"""Test that when a test succeeds, it is added to the results.""" | ||
monkeypatch.chdir(request.fspath.dirname) | ||
tester = PyTester( | ||
specs=TestSpecs.from_json( | ||
""" | ||
{ | ||
"test_data": { | ||
"script_files": ["fixtures/sample_tests_success.py"], | ||
"category": ["instructor"], | ||
"timeout": 30, | ||
"tester": "pytest", | ||
"output_verbosity": "short", | ||
"extra_info": { | ||
"criterion": "", | ||
"name": "Python Test Group 1" | ||
} | ||
} | ||
} | ||
""" | ||
) | ||
) | ||
results = tester.run_python_tests() | ||
assert len(results) == 1 | ||
assert "fixtures/sample_tests_success.py" in results | ||
assert len(results["fixtures/sample_tests_success.py"]) == 1 | ||
|
||
result = results["fixtures/sample_tests_success.py"][0] | ||
assert result["status"] == "success" | ||
# nodeid is inexact in CI test | ||
assert result["name"].endswith("fixtures/sample_tests_success.py::test_add_one") | ||
assert result["errors"] == "" | ||
assert result["description"] is None | ||
|
||
|
||
def test_skip(request, monkeypatch) -> None: | ||
"""Test that when a test is skipped, it is omitted from the results.""" | ||
monkeypatch.chdir(request.fspath.dirname) | ||
tester = PyTester( | ||
specs=TestSpecs.from_json( | ||
""" | ||
{ | ||
"test_data": { | ||
"script_files": ["fixtures/sample_tests_skip.py"], | ||
"category": ["instructor"], | ||
"timeout": 30, | ||
"tester": "pytest", | ||
"output_verbosity": "short", | ||
"extra_info": { | ||
"criterion": "", | ||
"name": "Python Test Group 1" | ||
} | ||
} | ||
} | ||
""" | ||
) | ||
) | ||
results = tester.run_python_tests() | ||
assert results == {"fixtures/sample_tests_skip.py": []} |