[exception handling] Fix case the current working directory (CWD) gets deleted during testing.

Fixes #1235.
This commit is contained in:
marscher
2016-06-07 15:43:05 +02:00
committed by Martin K. Scherer
parent 70fdab4cfa
commit 09d163aa3a
5 changed files with 30 additions and 5 deletions

View File

@@ -925,3 +925,14 @@ def test_repr_traceback_with_unicode(style, encoding):
repr_traceback = formatter.repr_traceback(e_info)
assert repr_traceback is not None
def test_cwd_deleted(testdir):
testdir.makepyfile("""
def test(tmpdir):
tmpdir.chdir()
tmpdir.remove()
assert False
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines(['* 1 failed in *'])
assert 'INTERNALERROR' not in result.stdout.str() + result.stderr.str()