Skip to content

Commit

Permalink
Fixed expected colored statistics
Browse files Browse the repository at this point in the history
As of 5.3.0 Pytest improved colored statistics of the outcome:
https://docs.pytest.org/en/5.3.0/changelog.html#improvements

Signed-off-by: Stanislav Levin <slev@altlinux.org>
  • Loading branch information
stanislavlevin committed May 7, 2020
1 parent 6acc999 commit a3d7e8d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/test_display.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pytest import skip
from pytest import __version__ as pytest_version

# Load some fixtures we expose, without actually loading our entire plugin
from pytest_relaxed.fixtures import environ # noqa
Expand All @@ -8,6 +9,7 @@
# (May not be feasible if it has to assume something about how our collection
# works?) CLI option (99% sure we can hook into that as a plugin)?

pytest_version_info = tuple(map(int, pytest_version.split(".")[:3]))

def _expect_regular_output(testdir):
output = testdir.runpytest().stdout.str()
Expand Down Expand Up @@ -225,7 +227,13 @@ def behavior_four(self):
assert "== FAILURES ==" in output
assert "AssertionError" in output
# Summary
assert "== 1 failed, 4 passed, 1 skipped in " in output
if pytest_version_info >= (5, 3):
expected_out = (
"== \x1b[31m\x1b[1m1 failed\x1b[0m, \x1b[32m4 passed\x1b[0m, "
"\x1b[33m1 skipped\x1b[0m\x1b[31m in ")
else:
expected_out = "== 1 failed, 4 passed, 1 skipped in "
assert expected_out in output

def test_nests_many_levels_deep_no_problem(self, testdir):
testdir.makepyfile(
Expand Down

0 comments on commit a3d7e8d

Please sign in to comment.