| load("@rules_python//python:py_binary.bzl", "py_binary") | |
| load("@rules_python//tests/support:explicit_init_py_test.bzl", "explicit_init_py_test") | |
| load("@rules_python//tests/support:py_reconfig.bzl", "py_reconfig_binary") | |
| package( | |
| default_visibility = ["//visibility:public"], | |
| ) | |
| py_reconfig_binary( | |
| name = "external_main", | |
| srcs = [":external_main.py"], | |
| # We're testing a system_python specific code path, | |
| # so force using that bootstrap | |
| bootstrap_impl = "system_python", | |
| main = "external_main.py", | |
| ) | |
| py_binary( | |
| name = "venv_bin", | |
| srcs = ["venv_bin.py"], | |
| config_settings = { | |
| "@rules_python//python/config_settings:bootstrap_impl": "script", | |
| "@rules_python//python/config_settings:venvs_site_packages": "yes", | |
| }, | |
| deps = [ | |
| # Add two packages that install into the same directory. This is | |
| # to test that namespace packages install correctly and are importable. | |
| "//nspkg_delta", | |
| "//nspkg_gamma", | |
| ], | |
| ) | |
| explicit_init_py_test( | |
| name = "test_module_dep_no_init", | |
| expect_generated_init = False, | |
| main = "external_main.py", | |
| ) | |
| explicit_init_py_test( | |
| name = "test_legacy_create_init_override", | |
| expect_generated_init = True, | |
| legacy_create_init = 1, | |
| main = "external_main.py", | |
| ) | |
| # These tests are run by @rules_python//tests/explicit_init_py to ensure a | |
| # module's configuration is respected when it's a dependency. | |
| test_suite( | |
| name = "explicit_init_py_tests", | |
| tests = [ | |
| ":test_legacy_create_init_override", | |
| ":test_module_dep_no_init", | |
| "@init_py_test_extension_repo//:test", | |
| "@init_py_test_repo//:test", | |
| ], | |
| ) |