Commits

holger krekel committed abb19eb

add a test for robustness of capturing when a test closes FD1/2

  • Participants
  • Parent commits 443d479

Comments (0)

Files changed (1)

File testing/test_capture.py

         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*
+    """)
+