Skip to content

Commit

Permalink
Always create an empty MODULE.bazel for python tests
Browse files Browse the repository at this point in the history
To prevent python tests from accessing BCR, this was missed in 055e25b

Closes #22089.

PiperOrigin-RevId: 627384354
Change-Id: Ic4545616fad88f479b24553eb7ffe81004d41090
  • Loading branch information
meteorcloudy authored and Copybara-Service committed Apr 23, 2024
1 parent acbe2fe commit c900865
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/py/bazel/bazel_workspace_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def setUp(self):
self.DisableBzlmod()

def testWorkspaceDotBazelFileInMainRepo(self):
# Make sure no existing MODULE.bazel file.
os.remove("MODULE.bazel")
workspace_dot_bazel = self.ScratchFile("WORKSPACE.bazel")
self.ScratchFile("BUILD", [
"py_binary(",
Expand Down
3 changes: 3 additions & 0 deletions src/test/py/bazel/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ def setUp(self):
# Prefer ipv6 network on macOS
f.write('startup --host_jvm_args=-Djava.net.preferIPv6Addresses=true\n')
f.write('build --jvmopt=-Djava.net.preferIPv6Addresses\n')
# An empty MODULE.bazel and a corresponding MODULE.bazel.lock will prevent
# tests from accessing BCR
self.ScratchFile('MODULE.bazel')
self.CopyFile(
self.Rlocation('io_bazel/src/test/tools/bzlmod/MODULE.bazel.lock'),
'MODULE.bazel.lock',
Expand Down

0 comments on commit c900865

Please sign in to comment.