Report teardown output on test failure
Until now, teardown stdout/stderr output was not reported upon test failure. However such output is sometime necessary to understand the failure. fix #442
This commit is contained in:
@@ -370,6 +370,31 @@ class TestFixtureReporting:
|
||||
"*1 failed*1 error*",
|
||||
])
|
||||
|
||||
def test_setup_teardown_output_and_test_failure(self, testdir):
|
||||
""" Test for issue #442 """
|
||||
testdir.makepyfile("""
|
||||
def setup_function(function):
|
||||
print ("setup func")
|
||||
|
||||
def test_fail():
|
||||
assert 0, "failingfunc"
|
||||
|
||||
def teardown_function(function):
|
||||
print ("teardown func")
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_fail*",
|
||||
"*def test_fail():",
|
||||
"*failingfunc*",
|
||||
"*Captured stdout setup*",
|
||||
"*setup func*",
|
||||
"*Captured stdout teardown*",
|
||||
"*teardown func*",
|
||||
|
||||
"*1 failed*",
|
||||
])
|
||||
|
||||
class TestTerminalFunctional:
|
||||
def test_deselected(self, testdir):
|
||||
testpath = testdir.makepyfile("""
|
||||
|
||||
Reference in New Issue
Block a user