mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-09 08:22:19 +02:00
test: retain ownership of sockets and subprocess groups
This commit is contained in:
@@ -15,6 +15,7 @@ because an absent mechanism read as a successful answer.
|
||||
"""
|
||||
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
@@ -35,11 +36,11 @@ def sleeper():
|
||||
|
||||
yield _spawn
|
||||
for proc in procs:
|
||||
try:
|
||||
proc.kill()
|
||||
proc.wait(timeout=5)
|
||||
except Exception:
|
||||
pass
|
||||
# Each child owns a session/process group. Keep the leader unreaped
|
||||
# until its group is signalled, so the group id cannot be recycled.
|
||||
if proc.returncode is None:
|
||||
os.killpg(proc.pid, signal.SIGKILL)
|
||||
proc.wait(timeout=5)
|
||||
|
||||
|
||||
# ── Verdicts, against real processes ────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user