import os import runpy import subprocess import sys bash = r"C:\Program Files\Git\bin\bash.exe" original_popen = subprocess.Popen def compatible_popen(args, **kwargs): if isinstance(args, (list, tuple)) and len(args) == 1: args = [bash, args[0]] return original_popen(args, **kwargs) subprocess.Popen = compatible_popen sys.path.insert(0, os.path.abspath("tests")) mode = sys.argv[1] if len(sys.argv) > 1 else "failover" if mode not in ("persistence", "failover"): raise SystemExit("Mode must be persistence or failover") sys.argv = [ "tests/resilience.py", "--mode", mode, "--action-script", "scripts/restart.sh" if mode == "persistence" else "scripts/stop-one.sh", "--base-url", "http://localhost:8080", ] runpy.run_path("tests/resilience.py", run_name="__main__")