summaryrefslogtreecommitdiff
path: root/Lib/test/test_logging.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r--Lib/test/test_logging.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index e223522cc7..2ad3c5c208 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -727,30 +727,19 @@ class HandlerTest(BaseTest):
locks_held__ready_to_fork.wait()
pid = os.fork()
- if pid == 0: # Child.
+ if pid == 0:
+ # Child process
try:
test_logger.info(r'Child process did not deadlock. \o/')
finally:
os._exit(0)
- else: # Parent.
+ else:
+ # Parent process
test_logger.info(r'Parent process returned from fork. \o/')
fork_happened__release_locks_and_end_thread.set()
lock_holder_thread.join()
- start_time = time.monotonic()
- while True:
- test_logger.debug('Waiting for child process.')
- waited_pid, status = os.waitpid(pid, os.WNOHANG)
- if waited_pid == pid:
- break # child process exited.
- if time.monotonic() - start_time > 7:
- break # so long? implies child deadlock.
- time.sleep(0.05)
- test_logger.debug('Done waiting.')
- if waited_pid != pid:
- os.kill(pid, signal.SIGKILL)
- waited_pid, status = os.waitpid(pid, 0)
- self.fail("child process deadlocked.")
- self.assertEqual(status, 0, msg="child process error")
+
+ support.wait_process(pid, exitcode=0)
class BadStream(object):