Skip to content

Commit 0fc3b2f

Browse files
bpo-35363: test_eintr runs eintr_tester.py in verbose mode (GH-10965)
Moreover, "python3 -m test test_eintr -v" now avoids redirecting stdout/stderr to a pipe, the child process inherits stdout/stderr from the parent. (cherry picked from commit aa8ae90) Co-authored-by: Victor Stinner <vstinner@redhat.com>
1 parent 022d7bc commit 0fc3b2f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Lib/test/test_eintr.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
22
import signal
3+
import subprocess
4+
import sys
35
import unittest
46

57
from test import support
@@ -15,7 +17,19 @@ def test_all(self):
1517
# thread (for reliable signal delivery).
1618
tester = support.findfile("eintr_tester.py", subdir="eintrdata")
1719
# use -u to try to get the full output if the test hangs or crash
18-
script_helper.assert_python_ok("-u", tester)
20+
args = ["-u", tester, "-v"]
21+
if support.verbose:
22+
print()
23+
print("--- run eintr_tester.py ---")
24+
# In verbose mode, the child process inherit stdout and stdout,
25+
# to see output in realtime and reduce the risk of loosing output.
26+
args = [sys.executable, "-E", "-X", "faulthandler", *args]
27+
proc = subprocess.run(args)
28+
print(f"--- eintr_tester.py completed: exit code {proc.returncode} ---")
29+
if proc.returncode:
30+
self.fail("eintr_tester.py failed")
31+
else:
32+
script_helper.assert_python_ok("-u", tester, "-v")
1933

2034

2135
if __name__ == "__main__":

0 commit comments

Comments
 (0)