Skip to content

Commit 8f23f3a

Browse files
committed
Reduced test timing to 112 seconds. Also, added fix for lint
1 parent 430b843 commit 8f23f3a

5 files changed

Lines changed: 16 additions & 14 deletions

File tree

modules/01-operating-room/tests/test_dds_communication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def test_arm_receives_motor_control(self, proc_manager, dds_participant):
233233
from Types import SurgicalRobot, SurgicalRobot_MotorControl
234234

235235
proc = proc_manager.start_app("Arm", extra_env=self.QT_ENV)
236-
wait_for_process_ready(proc, timeout_sec=10)
236+
wait_for_process_ready(proc, timeout_sec=3)
237237
assert proc.poll() is None, f"Arm exited early with code {proc.returncode}"
238238

239239
writer = create_writer(

modules/01-operating-room/tests/test_demo_flow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,9 @@ def test_secure_launch(self, proc_manager_secure, dds_env_secure):
310310
# Wait for security handshake and DDS initialization (parallel).
311311
# Apps that fail the handshake crash within the first 1-2 s; 3 s is
312312
# enough to catch startup failures while keeping the test fast.
313-
threads = [threading.Thread(target=wait_for_process_ready, args=(p, 3)) for p in apps.values()]
313+
threads = [
314+
threading.Thread(target=wait_for_process_ready, args=(p, 3)) for p in apps.values()
315+
]
314316
for t in threads:
315317
t.start()
316318
for t in threads:

modules/01-operating-room/tests/test_launch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class TestPatientMonitor:
8484

8585
def test_starts_and_stays_alive(self, proc_manager):
8686
proc = proc_manager.start_app("PatientMonitor", extra_env=self.QT_ENV)
87-
wait_for_process_ready(proc, timeout_sec=10)
87+
wait_for_process_ready(proc, timeout_sec=3)
8888
assert proc.poll() is None, f"PatientMonitor exited early with code {proc.returncode}"
8989

9090

@@ -96,7 +96,7 @@ class TestArm:
9696

9797
def test_starts_and_stays_alive(self, proc_manager):
9898
proc = proc_manager.start_app("Arm", extra_env=self.QT_ENV)
99-
wait_for_process_ready(proc, timeout_sec=10)
99+
wait_for_process_ready(proc, timeout_sec=3)
100100
assert proc.poll() is None, f"Arm exited early with code {proc.returncode}"
101101

102102

modules/02-record-playback/tests/test_recording.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_recording_creates_database(self, proc_manager, clean_recording_dir):
3636
"""Recording Service should create or_recording_database.dat."""
3737
# Start PatientSensor to produce t/Vitals data
3838
ps = proc_manager.start_app("PatientSensor")
39-
wait_for_process_ready(ps, timeout_sec=10)
39+
wait_for_process_ready(ps, timeout_sec=5)
4040
assert ps.poll() is None, f"PatientSensor exited early with code {ps.returncode}"
4141

4242
# Start Recording Service
@@ -61,10 +61,10 @@ def test_recording_creates_database(self, proc_manager, clean_recording_dir):
6161
# Stop recording service gracefully
6262
rec_proc.terminate()
6363
try:
64-
rec_proc.wait(timeout=10)
64+
rec_proc.wait(timeout=5)
6565
except Exception:
6666
rec_proc.kill()
67-
rec_proc.wait(timeout=5)
67+
rec_proc.wait(timeout=3)
6868

6969
# Verify the database file was created
7070
db_file = RECORDING_DIR / "or_recording_database.dat"

modules/02-record-playback/tests/test_replay.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_replay_produces_vitals(self, proc_manager, dds_env_dict, clean_recordin
4444
"""Replay Service should publish t/Vitals from a recording."""
4545
# ── Phase 1: Record some data ─────────────────────────────────
4646
ps = proc_manager.start_app("PatientSensor")
47-
wait_for_process_ready(ps, timeout_sec=10)
47+
wait_for_process_ready(ps, timeout_sec=5)
4848
assert ps.poll() is None, f"PatientSensor exited early with code {ps.returncode}"
4949

5050
rec_proc = proc_manager.start(
@@ -61,25 +61,25 @@ def test_replay_produces_vitals(self, proc_manager, dds_env_dict, clean_recordin
6161

6262
rec_proc.terminate()
6363
try:
64-
rec_proc.wait(timeout=10)
64+
rec_proc.wait(timeout=5)
6565
except Exception:
6666
rec_proc.kill()
67-
rec_proc.wait(timeout=5)
67+
rec_proc.wait(timeout=3)
6868

6969
db_file = RECORDING_DIR / "or_recording_database.dat"
7070
assert db_file.is_file(), "Recording phase failed — no database"
7171

7272
# Kill PatientSensor so the only source of data is the replay
7373
proc_manager.shutdown_all()
74-
time.sleep(1)
74+
time.sleep(0.5)
7575

7676
# ── Phase 2: Replay and verify data arrives ───────────────────
7777
# Start Replay Service
7878
replay_proc = proc_manager.start(
7979
[REPLAY_SERVICE, "-cfgFile", self.REPLAY_CONFIG, "-cfgName", "RepServCfg"],
8080
cwd=MODULE_DIR,
8181
)
82-
wait_for_process_ready(replay_proc, timeout_sec=10)
82+
wait_for_process_ready(replay_proc, timeout_sec=5)
8383

8484
# Run a short subscriber in a subprocess to capture replayed data
8585
subscriber_script = f"""\
@@ -100,7 +100,7 @@ def test_replay_produces_vitals(self, proc_manager, dds_env_dict, clean_recordin
100100
reader = dds.DataReader(subscriber, topic, dr_qos)
101101
102102
collected = []
103-
deadline = time.monotonic() + 15
103+
deadline = time.monotonic() + 8
104104
while time.monotonic() < deadline and len(collected) < 3:
105105
for s in reader.take():
106106
if s.info.valid:
@@ -117,7 +117,7 @@ def test_replay_produces_vitals(self, proc_manager, dds_env_dict, clean_recordin
117117
cwd=MODULE_01_DIR,
118118
capture_output=True,
119119
text=True,
120-
timeout=30,
120+
timeout=20,
121121
check=False,
122122
)
123123
assert result.returncode == 0, (

0 commit comments

Comments
 (0)