[aDAG] Unflake aDAG + PP tests (#7600)

This commit is contained in:
SangBin Cho
2024-08-16 20:49:30 -07:00
committed by GitHub
parent bae888cb8e
commit 4706eb628e
3 changed files with 9 additions and 4 deletions

View File

@@ -384,6 +384,7 @@ def fork_new_process_for_each_test(
os.setpgrp()
from _pytest.outcomes import Skipped
pid = os.fork()
print(f"Fork a new process to run a test {pid}")
if pid == 0:
try:
f(*args, **kwargs)
@@ -401,11 +402,11 @@ def fork_new_process_for_each_test(
pgid = os.getpgid(pid)
_pid, _exitcode = os.waitpid(pid, 0)
# ignore SIGTERM signal itself
old_singla_handler = signal.signal(signal.SIGTERM, signal.SIG_IGN)
old_signal_handler = signal.signal(signal.SIGTERM, signal.SIG_IGN)
# kill all child processes
os.killpg(pgid, signal.SIGTERM)
# restore the signal handler
signal.signal(signal.SIGTERM, old_singla_handler)
signal.signal(signal.SIGTERM, old_signal_handler)
assert _exitcode == 0, (f"function {f} failed when called with"
f" args {args} and kwargs {kwargs}")