I have a Python codebase with some tests that I am able to run with the python -m unittest... command however, when I run the same tests with bazel test, the tests just get stuck and time out. One thing to note is that the code is using python's multiprocessing, and also makes a bunch of post requests to an external service.
Using bazel run and logging entry points in several parts of the code verifies the code is randomly stuck.
top also does not show a lot of resources being used.
Any ideas on how to debug this? Most of the tests are set to size=large and have the "exclusive" tag.
The bazel sandbox by default blocks all network requests. You can specify that a given test requires network access by adding the tag requires-network.
Alternatively you can add the tag no-sandbox to disable the sandbox completely for the given test / action.
It is also possible that network access is disabled by a bazelrc option such as --modify_execution_info=TestRunner=+block-network so you might want to check your bazelrc too if the requires-network tag doesn't fix the timeouts in the tests.
Bazel testing getting stuck