add a test for robustness of capturing when a test closes FD1/2
This commit is contained in:
parent
9f7eac0ba1
commit
68e58e1493
|
@ -1010,3 +1010,21 @@ def test_capturing_and_logging_fundamentals(testdir, method):
|
|||
WARNING:root:hello2
|
||||
""")
|
||||
assert "atexit" not in result.stderr.str()
|
||||
|
||||
def test_close_and_capture_again(testdir):
|
||||
testdir.makepyfile("""
|
||||
import os
|
||||
def test_close():
|
||||
os.close(1)
|
||||
def test_capture_again():
|
||||
os.write(1, "hello\\n")
|
||||
assert 0
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines("""
|
||||
*test_capture_again*
|
||||
*assert 0*
|
||||
*stdout*
|
||||
*hello*
|
||||
""")
|
||||
|
||||
|
|
Loading…
Reference in New Issue