Merge branch 'issue_960' of https://github.com/Akasurde/pytest
This commit is contained in:
commit
41d2faccea
|
@ -21,7 +21,7 @@ def pytest_addoption(parser):
|
|||
group._addoption('-r',
|
||||
action="store", dest="reportchars", default=None, metavar="chars",
|
||||
help="show extra test summary info as specified by chars (f)ailed, "
|
||||
"(E)error, (s)skipped, (x)failed, (X)passed (w)warnings.")
|
||||
"(E)error, (s)skipped, (x)failed, (X)passed (w)warnings (a)all.")
|
||||
group._addoption('-l', '--showlocals',
|
||||
action="store_true", dest="showlocals", default=False,
|
||||
help="show locals in tracebacks (disabled by default).")
|
||||
|
@ -66,8 +66,10 @@ def getreportopt(config):
|
|||
reportchars = config.option.reportchars
|
||||
if reportchars:
|
||||
for char in reportchars:
|
||||
if char not in reportopts:
|
||||
if char not in reportopts and char != 'a':
|
||||
reportopts += char
|
||||
elif char == 'a':
|
||||
reportopts = 'fEsxXw'
|
||||
return reportopts
|
||||
|
||||
def pytest_report_teststatus(report):
|
||||
|
|
|
@ -549,6 +549,43 @@ def test_reportchars_error(testdir):
|
|||
'ERROR*test_foo*',
|
||||
])
|
||||
|
||||
def test_reportchars_all(testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
def test_1():
|
||||
assert 0
|
||||
@pytest.mark.xfail
|
||||
def test_2():
|
||||
assert 0
|
||||
@pytest.mark.xfail
|
||||
def test_3():
|
||||
pass
|
||||
def test_4():
|
||||
pytest.skip("four")
|
||||
""")
|
||||
result = testdir.runpytest("-ra")
|
||||
result.stdout.fnmatch_lines([
|
||||
"FAIL*test_1*",
|
||||
"SKIP*four*",
|
||||
"XFAIL*test_2*",
|
||||
"XPASS*test_3*",
|
||||
])
|
||||
|
||||
def test_reportchars_all_error(testdir):
|
||||
testdir.makepyfile(
|
||||
conftest="""
|
||||
def pytest_runtest_teardown():
|
||||
assert 0
|
||||
""",
|
||||
test_simple="""
|
||||
def test_foo():
|
||||
pass
|
||||
""")
|
||||
result = testdir.runpytest('-ra')
|
||||
result.stdout.fnmatch_lines([
|
||||
'ERROR*test_foo*',
|
||||
])
|
||||
|
||||
@pytest.mark.xfail("hasattr(sys, 'pypy_version_info')")
|
||||
def test_errors_in_xfail_skip_expressions(testdir):
|
||||
testdir.makepyfile("""
|
||||
|
|
Loading…
Reference in New Issue