Debian Codegraph @

tests/integration_test_wrapper.py.in

raw
1 #!/usr/bin/env python3
2 """Wrapper to check if Orca is running before running integration tests."""
3
4 import subprocess
5 import sys
6
7 def is_orca_running():
8 """Check if Orca D-Bus service is available."""
9 try:
10 result = subprocess.run([
11 "python3", "-c",
12 "from dasbus.connection import SessionMessageBus; "
13 "bus = SessionMessageBus(); "
14 "proxy = bus.get_proxy('org.gnome.Orca.Service', '/org/gnome/Orca/Service'); "
15 "proxy.GetVersion()"
16 ], capture_output=True, timeout=5, check=False)
17 return result.returncode == 0
18 except (subprocess.TimeoutExpired, FileNotFoundError):
19 return False
20
21 if __name__ == "__main__":
22 if len(sys.argv) != 2:
23 print("Usage: integration_test_wrapper.py <test_file>", file=sys.stderr)
24 sys.exit(1)
25
26 test_file = sys.argv[1]
27
28 # Check if Orca is running before attempting tests
29 if not is_orca_running():
30 sys.exit(77) # Standard skip exit code
31
32 # Run pytest normally if Orca is available
33 pytest_result = subprocess.run([
34 "@PYTHON@", "-m", "pytest", test_file, "-v"
35 ], check=False)
36
37 sys.exit(pytest_result.returncode)