checkpoint post gui2_parity
This commit is contained in:
@@ -4,6 +4,13 @@ import time
|
||||
import requests
|
||||
import os
|
||||
import signal
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Ensure project root is in path
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
from api_hook_client import ApiHookClient
|
||||
|
||||
def kill_process_tree(pid):
|
||||
"""Robustly kills a process and all its children."""
|
||||
@@ -67,10 +74,17 @@ def live_gui(request):
|
||||
kill_process_tree(process.pid)
|
||||
pytest.fail(f"Failed to start {gui_script} with test hooks.")
|
||||
|
||||
client = ApiHookClient() # Initialize client here
|
||||
try:
|
||||
yield process, gui_script
|
||||
finally:
|
||||
print(f"\n[Fixture] Finally block triggered: Shutting down {gui_script}...")
|
||||
# Reset the GUI state before shutting down
|
||||
try:
|
||||
client.reset_session()
|
||||
time.sleep(1) # Give GUI time to process reset
|
||||
except Exception as e:
|
||||
print(f"[Fixture] Error resetting GUI session: {e}")
|
||||
kill_process_tree(process.pid)
|
||||
log_file.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user