Files
reverse-engineering-anything/scripts/run-python-tests.py
T
morlutoandCursor Agent 77b09314ff test(ci): require provider checks and reduce test startup (#8145)
* test(ci): require provider coverage and reuse test sessions

* fix(ci): prepare the runtime before Python producer tests

The fast Python job ran the suite on a fresh checkout, so analysis-efficiency
checks failed without compiled process modules. Install locked dependencies
and prepare the runtime before the suite.

* fix(ci): keep provider test reports inside the checkout

The provider-report reader accepted an arbitrary path from argv. Resolve the
path and reject anything outside the checkout before reading it. The packet
and signal workflows write those reports under .cache.

* fix(ci): require a test module in each named Python bridge family

Discovery still runs every bridge test. The mitmproxy, native, and pwndbg
families must each keep a test module, so deleting one cannot pass through
the others.

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-10-30 19:34:19 +08:00

51 lines
1.5 KiB
Python

"""Run every source-owned Python bridge and analysis-efficiency test."""
from pathlib import Path
import json
import subprocess
import sys
root = Path(__file__).resolve().parent.parent
# The previous explicit command named these families. Discovery still runs
# every bridge test, and each named family must keep a test module.
REQUIRED_BRIDGE_FAMILIES = ("mitmproxy", "native", "pwndbg")
def fail(code, **details):
print(json.dumps({"code": code, **details}, sort_keys=True), file=sys.stderr)
raise SystemExit(1)
def family_tests(family):
return [
path
for path in root.joinpath("bridge", family).rglob("test_*.py")
if path.is_file()
]
missing_families = [
family for family in REQUIRED_BRIDGE_FAMILIES if not family_tests(family)
]
if missing_families:
fail("missing_bridge_family", families=missing_families)
bridge_tests = sorted(root.joinpath("bridge").rglob("test_*.py"))
if not bridge_tests:
fail("missing_bridge_tests")
if not list(root.joinpath("tests/support/analysis-efficiency").glob("test_*.py")):
fail("missing_analysis_efficiency_tests")
modules = [
".".join(path.relative_to(root).with_suffix("").parts) for path in bridge_tests
]
commands = [
[sys.executable, "-m", "unittest", "-v", *modules],
[
sys.executable, "-m", "unittest", "discover",
"-s", "tests/support/analysis-efficiency", "-p", "test_*.py", "-v",
],
]
for command in commands:
result = subprocess.run(command, cwd=root, check=False)
if result.returncode:
sys.exit(result.returncode)