Skip to content

Commit

Permalink
[7.2.0] Always create an empty MODULE.bazel for python tests (#22097)
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

Commit
c900865

Co-authored-by: Yun Peng <pcloudy@google.com>
  • Loading branch information
iancha1992 and meteorcloudy committed May 6, 2024
1 parent fed3603 commit b9fd0a3
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 @@ -138,6 +138,9 @@ def setUp(self):
# For reducing SSD usage on our physical Mac machines.
f.write('common --experimental_repository_cache_hardlinks\n')
f.write('common --enable_bzlmod\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 b9fd0a3

Please sign in to comment.