We have example_package
, which is a Python module itself, so we can access example_package.my_module
in code. We also defined example_package.math
, since we have some simple math routines. We have some tests, which Bazel will effectively place in the same directory as these submodule files.
When we do this, any tests that Bazel generates in that directory which are Python binaries will have math
shadowed on Mac, but not on Ubuntu.
Reproduction steps: https://github.com/EricCousineau-TRI/repro/blob/b08bc47/bug/mac_builtin_shadow/test.sh#L38
Why is this?
Bazel Background
In Bazel, we you decide to effectively place our unittests in the same package (BUILD.bazel
file) as our modules. Bazel will generate wrapper Python scripts (for adjusting environment variables, unpacking archives, etc.), and place them according to the name of the test.
As an example, in //example_package
, if I define py_library(name = "my_module", ...)
, and then define py_test(name = "my_module_test", srcs = ["test/my_module_test.py"], ...)
in that same package, Bazel will generate a file ./bazel-bin/example_package/my_module_test
(which is reflecting what is in .runfiles
) - note that it is not under ./bazel-bin/example_package/test/my_module_test
.