MCPcopy Create free account
hub / github.com/pytorch/executorch / _run_single_test

Function _run_single_test

backends/mlx/test/run_all_tests.py:60–105  ·  view source on GitHub ↗

Run a single test configuration in a subprocess. Called via multiprocessing.Pool.starmap for parallel execution. Recreates the test instance from the class name and kwargs. Args: test_class_name: Name of the test class module.path config_name: Name of this configur

(
    test_class_name: str,
    config_name: str,
    config_kwargs: dict,
    verbose: bool,
    timeout: int,
)

Source from the content-addressed store, hash-verified

58
59
60def _run_single_test(
61 test_class_name: str,
62 config_name: str,
63 config_kwargs: dict,
64 verbose: bool,
65 timeout: int,
66) -> Tuple[str, bool, Optional[str]]:
67 """
68 Run a single test configuration in a subprocess.
69
70 Called via multiprocessing.Pool.starmap for parallel execution.
71 Recreates the test instance from the class name and kwargs.
72
73 Args:
74 test_class_name: Name of the test class module.path
75 config_name: Name of this configuration
76 config_kwargs: Kwargs to recreate the test instance
77 verbose: Whether to print verbose output
78 timeout: Timeout in seconds
79
80 Returns:
81 (config_name, passed, error_message)
82 """
83 try:
84 # Re-discover and import tests in this subprocess
85 discover_and_import_tests()
86
87 # Find the test config by name
88 all_configs = get_all_test_configs()
89 test_instance = None
90 for name, instance in all_configs:
91 if name == config_name:
92 test_instance = instance
93 break
94
95 if test_instance is None:
96 return (config_name, False, f"Could not find test config: {config_name}")
97
98 # Run the test
99 passed = test_instance.run_test(verbose=verbose, timeout=timeout)
100 return (config_name, passed, None)
101
102 except Exception as e:
103 import traceback
104
105 return (config_name, False, f"Exception: {e}\n{traceback.format_exc()}")
106
107
108def run_tests_sequential(

Callers

nothing calls this directly

Calls 3

get_all_test_configsFunction · 0.85
run_testMethod · 0.45

Tested by

no test coverage detected