MCPcopy Index your code
hub / github.com/RustPython/RustPython / run_test

Function run_test

scripts/update_lib/cmd_auto_mark.py:47–71  ·  view source on GitHub ↗

Run a test with RustPython and return parsed results. Args: test_name: Test module name (e.g., "test_foo" or "test_ctypes.test_bar") skip_build: If True, use pre-built binary instead of cargo run Returns: TestResult with parsed test results

(test_name: str, skip_build: bool = False)

Source from the content-addressed store, hash-verified

45
46
47def run_test(test_name: str, skip_build: bool = False) -> TestResult:
48 """
49 Run a test with RustPython and return parsed results.
50
51 Args:
52 test_name: Test module name (e.g., "test_foo" or "test_ctypes.test_bar")
53 skip_build: If True, use pre-built binary instead of cargo run
54
55 Returns:
56 TestResult with parsed test results
57 """
58 if skip_build:
59 cmd = ["./target/release/rustpython"]
60 if sys.platform == "win32":
61 cmd = ["./target/release/rustpython.exe"]
62 else:
63 cmd = ["cargo", "run", "--release", "--"]
64
65 result = subprocess.run(
66 cmd + ["-m", "test", "-v", "-u", "all", "--slowest", test_name],
67 stdout=subprocess.PIPE, # Capture stdout for parsing
68 stderr=None, # Let stderr pass through to terminal
69 text=True,
70 )
71 return parse_results(result)
72
73
74def _try_parse_test_info(test_info: str) -> tuple[str, str] | None:

Callers 2

auto_mark_fileFunction · 0.70
auto_mark_directoryFunction · 0.70

Calls 2

parse_resultsFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected