refactor: move bzl tests from pip_install to //tests (#1716)
With this move done, all of the tests (except the internal py_test ones)
should be under `//tests`.
diff --git a/.bazelrc b/.bazelrc
index 0037a96..186242f 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -4,8 +4,8 @@
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
# To update these lines, execute
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
-build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/dupe_requirements,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/pip_repository_entry_points,tests/integration/py_cc_toolchain_registered,tests/integration/ignore_root_user_error/submodule
-query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/dupe_requirements,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/pip_repository_entry_points,tests/integration/py_cc_toolchain_registered,tests/integration/ignore_root_user_error/submodule
+build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/dupe_requirements,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/pip_repository_entry_points,tests/integration/py_cc_toolchain_registered
+query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/dupe_requirements,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/pip_repository_entry_points,tests/integration/py_cc_toolchain_registered
test --test_output=errors
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 060cb9c..54aa043 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -41,7 +41,7 @@
hooks:
- id: update-deleted-packages
name: Update deleted packages
- language: script
+ language: system
entry: bazel run @rules_bazel_integration_test//tools:update_deleted_packages
files: ^((examples|tests)/.*/(MODULE.bazel|WORKSPACE|WORKSPACE.bzlmod|BUILD.bazel)|.bazelrc)$
pass_filenames: false
diff --git a/python/pip_install/private/test/BUILD.bazel b/python/pip_install/private/test/BUILD.bazel
deleted file mode 100644
index d4978f3..0000000
--- a/python/pip_install/private/test/BUILD.bazel
+++ /dev/null
@@ -1,20 +0,0 @@
-load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
-load(":requirements_parser_tests.bzl", parse_requirements_tests = "parse_tests")
-
-diff_test(
- name = "srcs_diff_test",
- failure_message = (
- "Please run 'bazel run //python/pip_install/private:srcs_module.update' " +
- "to update the 'srcs.bzl' module found in the same package."
- ),
- file1 = "//python/pip_install/private:srcs_module",
- file2 = "//python/pip_install/private:srcs.bzl",
- # TODO: The diff_test here fails on Windows. As does the
- # install script. This should be fixed.
- target_compatible_with = select({
- "@platforms//os:windows": ["@platforms//:incompatible"],
- "//conditions:default": [],
- }),
-)
-
-parse_requirements_tests(name = "test_parse_requirements")
diff --git a/tests/pip_install/BUILD.bazel b/tests/pip_install/BUILD.bazel
index e69de29..60d25de 100644
--- a/tests/pip_install/BUILD.bazel
+++ b/tests/pip_install/BUILD.bazel
@@ -0,0 +1,17 @@
+load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
+
+diff_test(
+ name = "srcs_diff_test",
+ failure_message = (
+ "Please run 'bazel run //python/pip_install/private:srcs_module.update' " +
+ "to update the 'srcs.bzl' module found in the same package."
+ ),
+ file1 = "//python/pip_install/private:srcs_module",
+ file2 = "//python/pip_install/private:srcs.bzl",
+ # TODO: The diff_test here fails on Windows. As does the
+ # install script. This should be fixed.
+ target_compatible_with = select({
+ "@platforms//os:windows": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ }),
+)
diff --git a/tests/pip_install/requirements_parser/BUILD.bazel b/tests/pip_install/requirements_parser/BUILD.bazel
new file mode 100644
index 0000000..2787f16
--- /dev/null
+++ b/tests/pip_install/requirements_parser/BUILD.bazel
@@ -0,0 +1,3 @@
+load(":requirements_parser_tests.bzl", parse_requirements_tests = "parse_tests")
+
+parse_requirements_tests(name = "test_parse_requirements")
diff --git a/python/pip_install/private/test/requirements_parser_tests.bzl b/tests/pip_install/requirements_parser/requirements_parser_tests.bzl
similarity index 100%
rename from python/pip_install/private/test/requirements_parser_tests.bzl
rename to tests/pip_install/requirements_parser/requirements_parser_tests.bzl