MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / find_test_root

Function find_test_root

test/general/lm_eval/utils.py:249–263  ·  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

247
248@positional_deprecated
249def find_test_root(start_path: pathlib.Path) -> pathlib.Path:
250 """
251 Search upward in the directory tree to a maximum of three layers
252 to find and return the package root (containing the 'tests' folder)
253 """
254 cur_path = start_path.resolve()
255 max_layers = 3
256 for _ in range(max_layers):
257 if (cur_path / "tests" / "test_version_stable.py").exists():
258 return cur_path
259 else:
260 cur_path = cur_path.parent.resolve()
261 raise FileNotFoundError(
262 f"Unable to find package root within {max_layers} upwards" + f"of {start_path}"
263 )
264
265
266@positional_deprecated

Callers 1

run_task_testsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected