Skip to content

Commit 2ba7e88

Browse files
committed
Fix test collection and harness teardown on CI runners
The characterization harness is a session leader whose controlling terminal is the PTY it opens; Linux delivers SIGHUP when the master closes, killing it before the report is written. Ignore the hangup — it is teardown noise. test_terminal_process imported termios at module level, breaking collection on Windows; move it behind the existing platform guard.
1 parent d4f8020 commit 2ba7e88

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎tests/test_pty_characterization.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,19 @@
7878
import fcntl
7979
import json
8080
import os
81+
import signal
8182
import subprocess
8283
import sys
8384
import termios
8485
8586
PROBE_TIMEOUT_SECONDS = 20
8687
CLEANUP_TIMEOUT_SECONDS = 10
8788
89+
# Closing the PTY master hangs up the terminal; Linux delivers SIGHUP to this
90+
# process (session leader with the slave as controlling terminal) before the
91+
# report is written. The hangup is teardown noise, not part of the topology.
92+
signal.signal(signal.SIGHUP, signal.SIG_IGN)
93+
8894
8995
def reap(process):
9096
process.kill()

‎tests/test_terminal_process.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import signal
1212
import subprocess
1313
import sys
14-
import termios
1514
import threading
1615
import time
1716
from contextlib import contextmanager
@@ -24,6 +23,8 @@
2423
pytestmark = posix_only
2524

2625
if sys.platform != "win32":
26+
import termios
27+
2728
from render_machine import pty_exec
2829

2930
REPO_ROOT = Path(__file__).resolve().parent.parent

0 commit comments

Comments
 (0)