fix issue38 - nicer tracebacks on sessionstart/configure (and other internal/custom hook failures)

This commit is contained in:
holger krekel
2011-04-17 12:20:11 +02:00
parent bc4e4b38a9
commit 06ca7090f9
4 changed files with 33 additions and 3 deletions

View File

@@ -13,6 +13,26 @@ class TestGeneralUsage:
'*ERROR: hello'
])
def test_early_hook_error_issue38_1(self, testdir):
testdir.makeconftest("""
def pytest_sessionstart():
0 / 0
""")
result = testdir.runpytest(testdir.tmpdir)
assert result.ret != 0
# tracestyle is native by default for hook failures
result.stdout.fnmatch_lines([
'*INTERNALERROR*File*conftest.py*line 2*',
'*0 / 0*',
])
result = testdir.runpytest(testdir.tmpdir, "--fulltrace")
assert result.ret != 0
# tracestyle is native by default for hook failures
result.stdout.fnmatch_lines([
'*INTERNALERROR*def pytest_sessionstart():*',
'*INTERNALERROR*0 / 0*',
])
def test_file_not_found(self, testdir):
result = testdir.runpytest("asd")
assert result.ret != 0