Skip to content

Commit 30bd94d

Browse files
authored
tests: use {package} instead of hard-coded path in precompile_tests (bazel-contrib#2193)
When imported into Google, the workspace-relative path changes, which makes the tests fail. Using the `{package}` format kwarg makes the tests independent of their location in the workspace.
1 parent da0fe57 commit 30bd94d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/base_rules/precompile/precompile_tests.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,14 @@ _tests.append(_test_precompile_add_to_runfiles_decided_elsewhere)
266266

267267
def _test_precompile_add_to_runfiles_decided_elsewhere_impl(env, targets):
268268
env.expect.that_target(targets.binary).runfiles().contains_at_least([
269-
"{workspace}/tests/base_rules/precompile/__pycache__/bin.fakepy-45.pyc",
270-
"{workspace}/tests/base_rules/precompile/__pycache__/lib.fakepy-45.pyc",
271-
"{workspace}/tests/base_rules/precompile/bin.py",
272-
"{workspace}/tests/base_rules/precompile/lib.py",
269+
"{workspace}/{package}/__pycache__/bin.fakepy-45.pyc",
270+
"{workspace}/{package}/__pycache__/lib.fakepy-45.pyc",
271+
"{workspace}/{package}/bin.py",
272+
"{workspace}/{package}/lib.py",
273273
])
274274

275275
env.expect.that_target(targets.library).runfiles().contains_exactly([
276-
"{workspace}/tests/base_rules/precompile/lib.py",
276+
"{workspace}/{package}/lib.py",
277277
])
278278

279279
def _test_precompiler_action(name):

0 commit comments

Comments
 (0)