Skip to content

Commit d2c47ce

Browse files
authored
tests(coverage): use runfiles.CreateOrRaise() and rf.root() in coverage_collection_test (bazel-contrib#4446)
Use `runfiles.CreateOrRaise()` and `rf.root()` path navigation instead of `runfiles.Create()` with manual `None` assertions and `Rlocation()` in `coverage_collection_test.py`. Follow-up to bazel-contrib#4417
1 parent f457117 commit d2c47ce

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎tests/coverage/coverage_collection_test.py‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,11 @@ def _parse_lcov(path):
4848
class CoverageCollectionTest(unittest.TestCase):
4949
@classmethod
5050
def setUpClass(cls):
51-
rf = runfiles.Create()
52-
assert rf is not None
53-
program = rf.Rlocation(os.environ["INSTRUMENTED"])
54-
assert program is not None and os.path.exists(program), program
55-
lib_path = rf.Rlocation("_main/" + _LIB)
56-
assert lib_path is not None
57-
cls.lib_lines = pathlib.Path(lib_path).read_text().splitlines()
51+
rf = runfiles.CreateOrRaise()
52+
root = rf.root()
53+
program = root / os.environ["INSTRUMENTED"]
54+
assert program.exists(), program
55+
cls.lib_lines = (root / "_main" / _LIB).read_text().splitlines()
5856

5957
tmp = pathlib.Path(os.environ["TEST_TMPDIR"])
6058
coverage_dir = tmp / "coverage"

0 commit comments

Comments
 (0)