Skip to content

Commit

Permalink
Fix Windows failure and check for manifest entry
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Nov 7, 2022
1 parent a46b92d commit 4ae1965
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/test/py/bazel/bzlmod/bazel_module_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,11 @@ def testRunfilesRepoMappingManifest(self):
[bazel_command, '//:me', '--test_output=errors'],
allow_failure=True)
self.AssertExitCode(0, exit_code, stderr, stdout)
for path in ('bazel-bin/me.repo_mapping',
'bazel-bin/me.runfiles/_repo_mapping'):

paths = ['bazel-bin/me.repo_mapping']
if not self.IsWindows():
paths.append('bazel-bin/me.runfiles/_repo_mapping')
for path in paths:
with open(self.Path(path), 'r') as f:
self.assertEqual(
f.read().strip(), """,foo,foo~1.0
Expand All @@ -671,17 +674,26 @@ def testRunfilesRepoMappingManifest(self):
foo~1.0,foo,foo~1.0
foo~1.0,quux,quux~2.0
quux~2.0,quux,quux~2.0""")
with open(self.Path('bazel-bin/me.runfiles_manifest')) as f:
self.assertIn("_repo_mapping ", f.read())

exit_code, stderr, stdout = self.RunBazel(
[bazel_command, '@bar//:bar', '--test_output=errors'],
allow_failure=True)
self.AssertExitCode(0, exit_code, stderr, stdout)
for path in ('bazel-bin/external/bar~2.0/bar.repo_mapping',
'bazel-bin/external/bar~2.0/bar.runfiles/_repo_mapping'):

paths = ['bazel-bin/external/bar~2.0/bar.repo_mapping']
if not self.IsWindows():
paths.append('bazel-bin/external/bar~2.0/bar.runfiles/_repo_mapping')
for path in paths:
with open(self.Path(path), 'r') as f:
self.assertEqual(
f.read().strip(), """bar~2.0,bar,bar~2.0
bar~2.0,quux,quux~2.0
quux~2.0,quux,quux~2.0""")
with open(
self.Path('bazel-bin/external/bar~2.0/bar.runfiles_manifest')) as f:
self.assertIn("_repo_mapping ", f.read())

if __name__ == '__main__':
unittest.main()

0 comments on commit 4ae1965

Please sign in to comment.