Skip to content

Commit

Permalink
Merge branch 'maxnikulin/progress-summary-report-words'
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jan 15, 2022
2 parents 32f2092 + 9c7e3da commit d52f6ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
14 changes: 14 additions & 0 deletions pytest_subtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,17 @@ def pytest_report_to_serializable(report):
def pytest_report_from_serializable(data):
if data.get("_report_type") == "SubTestReport":
return SubTestReport._from_json(data)


@pytest.hookimpl(tryfirst=True)
def pytest_report_teststatus(report):
if report.when != "call" or not isinstance(report, SubTestReport):
return

outcome = report.outcome
if report.passed:
return outcome, ",", "SUBPASS"
elif report.skipped:
return outcome, "-", "SUBSKIP"
elif outcome == "failed":
return outcome, "u", "SUBFAIL"
22 changes: 11 additions & 11 deletions tests/test_subtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def test_simple_terminal_verbose(self, simple_script, testdir, mode):
result = testdir.runpytest("-v")
expected_lines = [
"*collected 1 item",
"test_simple_terminal_verbose.py::test_foo PASSED *100%*",
"test_simple_terminal_verbose.py::test_foo FAILED *100%*",
"test_simple_terminal_verbose.py::test_foo PASSED *100%*",
"test_simple_terminal_verbose.py::test_foo FAILED *100%*",
"test_simple_terminal_verbose.py::test_foo PASSED *100%*",
"test_simple_terminal_verbose.py::test_foo SUBPASS *100%*",
"test_simple_terminal_verbose.py::test_foo SUBFAIL *100%*",
"test_simple_terminal_verbose.py::test_foo SUBPASS *100%*",
"test_simple_terminal_verbose.py::test_foo SUBFAIL *100%*",
"test_simple_terminal_verbose.py::test_foo SUBPASS *100%*",
"test_simple_terminal_verbose.py::test_foo PASSED *100%*",
]
else:
Expand Down Expand Up @@ -189,17 +189,17 @@ def test_simple_terminal_verbose(self, simple_script, testdir, runner):
result = testdir.runpytest(simple_script, "-v")
expected_lines = [
"*collected 1 item",
"test_simple_terminal_verbose.py::T::test_foo FAILED *100%*",
"test_simple_terminal_verbose.py::T::test_foo FAILED *100%*",
"test_simple_terminal_verbose.py::T::test_foo SUBFAIL *100%*",
"test_simple_terminal_verbose.py::T::test_foo SUBFAIL *100%*",
"test_simple_terminal_verbose.py::T::test_foo PASSED *100%*",
]
else:
pytest.importorskip("xdist")
result = testdir.runpytest(simple_script, "-n1", "-v")
expected_lines = [
"gw0 [1]",
"*gw0*100%* FAILED test_simple_terminal_verbose.py::T::test_foo*",
"*gw0*100%* FAILED test_simple_terminal_verbose.py::T::test_foo*",
"*gw0*100%* SUBFAIL test_simple_terminal_verbose.py::T::test_foo*",
"*gw0*100%* SUBFAIL test_simple_terminal_verbose.py::T::test_foo*",
"*gw0*100%* PASSED test_simple_terminal_verbose.py::T::test_foo*",
]
result.stdout.fnmatch_lines(
Expand Down Expand Up @@ -324,8 +324,8 @@ def test_no_capture(self, testdir):
[
"start test",
"hello stdout A",
"Fhello stdout B",
"Fend test",
"uhello stdout B",
"uend test",
"*__ test (i='A') __*",
"*__ test (i='B') __*",
"*__ test __*",
Expand Down

0 comments on commit d52f6ad

Please sign in to comment.