From 1e6ba91cd9e19a0d05185904e359a7a21c95f136 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Thu, 5 Sep 2024 20:12:27 -0700 Subject: [PATCH] chore: use `{package}` instead of hard-coded path in precompile_tests 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. --- tests/base_rules/precompile/precompile_tests.bzl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/base_rules/precompile/precompile_tests.bzl b/tests/base_rules/precompile/precompile_tests.bzl index 62659fcfbd..22b86a71d2 100644 --- a/tests/base_rules/precompile/precompile_tests.bzl +++ b/tests/base_rules/precompile/precompile_tests.bzl @@ -266,14 +266,14 @@ _tests.append(_test_precompile_add_to_runfiles_decided_elsewhere) def _test_precompile_add_to_runfiles_decided_elsewhere_impl(env, targets): env.expect.that_target(targets.binary).runfiles().contains_at_least([ - "{workspace}/tests/base_rules/precompile/__pycache__/bin.fakepy-45.pyc", - "{workspace}/tests/base_rules/precompile/__pycache__/lib.fakepy-45.pyc", - "{workspace}/tests/base_rules/precompile/bin.py", - "{workspace}/tests/base_rules/precompile/lib.py", + "{workspace}/{package}/__pycache__/bin.fakepy-45.pyc", + "{workspace}/{package}/__pycache__/lib.fakepy-45.pyc", + "{workspace}/{package}/bin.py", + "{workspace}/{package}/lib.py", ]) env.expect.that_target(targets.library).runfiles().contains_exactly([ - "{workspace}/tests/base_rules/precompile/lib.py", + "{workspace}/{package}/lib.py", ]) def _test_precompiler_action(name):