8000 Add .bzl files explicitly to toolchain tests to detect .bzl file chan… · uventura/rules_python@369074e · GitHub
[go: up one dir, main page]

Skip to content

Commit 369074e

Browse files
fishcakezf0rmiga
andauthored
Add .bzl files explicitly to toolchain tests to detect .bzl file changes (bazel-contrib#815)
Co-authored-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
1 parent 2f764ce commit 369074e

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ filegroup(
3939
],
4040
visibility = [
4141
"//examples:__pkg__",
42+
"//python/tests/toolchains:__pkg__",
4243
"//tests:__pkg__",
4344
],
4445
)

python/tests/toolchains/defs.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ def _acceptance_test_impl(ctx):
3939
)
4040

4141
python_version_test = ctx.actions.declare_file("/".join([ctx.attr.python_version, "python_version_test.py"]))
42-
43-
# With the current approach in the run_acceptance_test.sh, we use this
44-
# symlink to find the absolute path to the rules_python to be passed to the
45-
# --override_repository rules_python=<rules_python_path>.
4642
ctx.actions.symlink(
4743
target_file = ctx.file._python_version_test,
4844
output = python_version_test,
@@ -92,7 +88,7 @@ def _acceptance_test_impl(ctx):
9288
python_version_test,
9389
run_acceptance_test_py,
9490
workspace,
95-
]
91+
] + ctx.files._distribution
9692
return [DefaultInfo(
9793
executable = executable,
9894
files = depset(
@@ -126,6 +122,10 @@ _acceptance_test = rule(
126122
allow_single_file = True,
127123
default = Label("//python/tests/toolchains/workspace_template:BUILD.bazel.tmpl"),
128124
),
125+
"_distribution": attr.label(
126+
doc = "The rules_python source distribution.",
127+
default = Label("//:distribution"),
128+
),
129129
"_python_version_test": attr.label(
130130
doc = "The python_version_test.py used to test the Python version.",
131131
allow_single_file = True,

python/tests/toolchains/run_acceptance_test.py.tmpl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ class TestPythonVersion(unittest.TestCase):
2121
@classmethod
2222
def setUpClass(cls):
2323
os.chdir("%test_location%")
24-
python_version_test_dirname = os.path.dirname(
25-
os.path.realpath("python_version_test.py")
26-
)
27-
rules_python_path = os.path.normpath(
28-
os.path.join(python_version_test_dirname, "..", "..", "..", "..")
29-
)
24+
rules_python_path = os.path.join(os.environ["TEST_SRCDIR"], "rules_python")
3025

3126
if %is_windows%:
3227
test_tmpdir = os.environ["TEST_TMPDIR"]

0 commit comments

Comments
 (0)
0