Change -ra to show errors and failures last, instead of first

Often in large test suites (like pytest's), the -ra summary is very useful
to obtain a list of failures so we can execute each test at once to fix them.

Problem is the default shows errors and failures first, which leads to a lot
of scrolling to get to them.
This commit is contained in:
Bruno Oliveira 2018-12-11 20:36:57 -02:00
parent bb363c8ff2
commit 9839ceffe0
2 changed files with 13 additions and 2 deletions

View File

@ -167,7 +167,7 @@ def getreportopt(config):
if char not in reportopts and char != "a":
reportopts += char
elif char == "a":
reportopts = "fEsxXw"
reportopts = "sxXwEf"
return reportopts

View File

@ -875,11 +875,22 @@ def test_reportchars_all(testdir):
pass
def test_4():
pytest.skip("four")
@pytest.fixture
def fail():
assert 0
def test_5(fail):
pass
"""
)
result = testdir.runpytest("-ra")
result.stdout.fnmatch_lines(
["FAIL*test_1*", "SKIP*four*", "XFAIL*test_2*", "XPASS*test_3*"]
[
"SKIP*four*",
"XFAIL*test_2*",
"XPASS*test_3*",
"ERROR*test_5*",
"FAIL*test_1*",
]
)