From c50613dd5f32ec0199faf251631183e532001e50 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Sun, 8 Nov 2026 14:14:01 -0800 Subject: [PATCH] tests(coverage): use runfiles.CreateOrRaise() and rf.root() in coverage_collection_test Use runfiles.CreateOrRaise() and rf.root() path navigation instead of runfiles.Create() + assert and Rlocation() in coverage_collection_test.py. --- tests/coverage/coverage_collection_test.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/coverage/coverage_collection_test.py b/tests/coverage/coverage_collection_test.py index 2baad9b03e..d44b83bf14 100644 --- a/tests/coverage/coverage_collection_test.py +++ b/tests/coverage/coverage_collection_test.py @@ -48,13 +48,11 @@ def _parse_lcov(path): class CoverageCollectionTest(unittest.TestCase): @classmethod def setUpClass(cls): - rf = runfiles.Create() - assert rf is not None - program = rf.Rlocation(os.environ["INSTRUMENTED"]) - assert program is not None and os.path.exists(program), program - lib_path = rf.Rlocation("_main/" + _LIB) - assert lib_path is not None - cls.lib_lines = pathlib.Path(lib_path).read_text().splitlines() + rf = runfiles.CreateOrRaise() + root = rf.root() + program = root / os.environ["INSTRUMENTED"] + assert program.exists(), program + cls.lib_lines = (root / "_main" / _LIB).read_text().splitlines() tmp = pathlib.Path(os.environ["TEST_TMPDIR"]) coverage_dir = tmp / "coverage"