MCPcopy Create free account
hub / github.com/OpenSparseLLMs/MoM / find_test_root

Function find_test_root

lm-eval-harness/lm_eval/utils.py:294–308  ·  view source on GitHub ↗

Search upward in the directory tree to a maximum of three layers to find and return the package root (containing the 'tests' folder)

(start_path: pathlib.Path)

Source from the content-addressed store, hash-verified

292
293@positional_deprecated
294def find_test_root(start_path: pathlib.Path) -> pathlib.Path:
295 """
296 Search upward in the directory tree to a maximum of three layers
297 to find and return the package root (containing the 'tests' folder)
298 """
299 cur_path = start_path.resolve()
300 max_layers = 3
301 for _ in range(max_layers):
302 if (cur_path / "tests" / "test_version_stable.py").exists():
303 return cur_path
304 else:
305 cur_path = cur_path.parent.resolve()
306 raise FileNotFoundError(
307 f"Unable to find package root within {max_layers} upwards" + f"of {start_path}"
308 )
309
310
311@positional_deprecated

Callers 1

run_task_testsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected