File: integration_test_wrapper.py.in

package info (click to toggle)
orca 49.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 53,532 kB
  • sloc: python: 98,331; javascript: 281; sh: 64; xml: 27; makefile: 5
file content (37 lines) | stat: -rw-r--r-- 1,197 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3
"""Wrapper to check if Orca is running before running integration tests."""

import subprocess
import sys

def is_orca_running():
    """Check if Orca D-Bus service is available."""
    try:
        result = subprocess.run([
            "python3", "-c",
            "from dasbus.connection import SessionMessageBus; "
            "bus = SessionMessageBus(); "
            "proxy = bus.get_proxy('org.gnome.Orca.Service', '/org/gnome/Orca/Service'); "
            "proxy.GetVersion()"
        ], capture_output=True, timeout=5, check=False)
        return result.returncode == 0
    except (subprocess.TimeoutExpired, FileNotFoundError):
        return False

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print("Usage: integration_test_wrapper.py <test_file>", file=sys.stderr)
        sys.exit(1)

    test_file = sys.argv[1]

    # Check if Orca is running before attempting tests
    if not is_orca_running():
        sys.exit(77)  # Standard skip exit code

    # Run pytest normally if Orca is available
    pytest_result = subprocess.run([
        "@PYTHON@", "-m", "pytest", test_file, "-v"
    ], check=False)

    sys.exit(pytest_result.returncode)