diff --git a/BUILD b/BUILD index ebdf74e788..7ea2aa4070 100644 --- a/BUILD +++ b/BUILD @@ -39,6 +39,7 @@ filegroup( ], visibility = [ "//examples:__pkg__", + "//python/tests/toolchains:__pkg__", "//tests:__pkg__", ], ) diff --git a/python/tests/toolchains/defs.bzl b/python/tests/toolchains/defs.bzl index 8c07d23885..2abc1ed149 100644 --- a/python/tests/toolchains/defs.bzl +++ b/python/tests/toolchains/defs.bzl @@ -39,10 +39,6 @@ def _acceptance_test_impl(ctx): ) python_version_test = ctx.actions.declare_file("/".join([ctx.attr.python_version, "python_version_test.py"])) - - # With the current approach in the run_acceptance_test.sh, we use this - # symlink to find the absolute path to the rules_python to be passed to the - # --override_repository rules_python=. ctx.actions.symlink( target_file = ctx.file._python_version_test, output = python_version_test, @@ -92,7 +88,7 @@ def _acceptance_test_impl(ctx): python_version_test, run_acceptance_test_py, workspace, - ] + ] + ctx.files._distribution return [DefaultInfo( executable = executable, files = depset( @@ -126,6 +122,10 @@ _acceptance_test = rule( allow_single_file = True, default = Label("//python/tests/toolchains/workspace_template:BUILD.bazel.tmpl"), ), + "_distribution": attr.label( + doc = "The rules_python source distribution.", + default = Label("//:distribution"), + ), "_python_version_test": attr.label( doc = "The python_version_test.py used to test the Python version.", allow_single_file = True, diff --git a/python/tests/toolchains/run_acceptance_test.py.tmpl b/python/tests/toolchains/run_acceptance_test.py.tmpl index 51eba3da3f..b3071a7b3c 100644 --- a/python/tests/toolchains/run_acceptance_test.py.tmpl +++ b/python/tests/toolchains/run_acceptance_test.py.tmpl @@ -21,12 +21,7 @@ class TestPythonVersion(unittest.TestCase): @classmethod def setUpClass(cls): os.chdir("%test_location%") - python_version_test_dirname = os.path.dirname( - os.path.realpath("python_version_test.py") - ) - rules_python_path = os.path.normpath( - os.path.join(python_version_test_dirname, "..", "..", "..", "..") - ) + rules_python_path = os.path.join(os.environ["TEST_SRCDIR"], "rules_python") if %is_windows%: test_tmpdir = os.environ["TEST_TMPDIR"]