Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed test case in test_subprocess
  • Loading branch information
chgnrdv committed May 26, 2023
commit bcbcb75ea595dee5cddde23b828506bcb4fcbdcd
9 changes: 6 additions & 3 deletions Lib/test/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -3330,20 +3330,23 @@ def test_communicate_repeated_call_after_stdout_close(self):
except subprocess.TimeoutExpired:
pass

def test_create_child_process_at_exit(self):
def test_preexec_at_exit(self):
code = f"""if 1:
import atexit
import subprocess

def dummy():
pass

def exit_handler():
subprocess.Popen({ZERO_RETURN_CMD})
subprocess.Popen({ZERO_RETURN_CMD}, preexec_fn=dummy)
print("shouldn't be printed")

atexit.register(exit_handler)
"""
_, out, err = assert_python_ok("-c", code)
self.assertEqual(out, b'')
self.assertIn(b"can't create child process at interpreter shutdown", err)
self.assertIn(b"preexec_fn not supported at interpreter shutdown", err)


@unittest.skipUnless(mswindows, "Windows specific tests")
Expand Down