Skip to content

Commit

Permalink
pythongh-102519: Avoid failing tests due to inaccessible volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
zooba committed Mar 14, 2023
1 parent 152292b commit 4af55ab
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -2683,12 +2683,17 @@ def test_listvolumes(self):

def test_listmounts(self):
for volume in os.listvolumes():
mounts = os.listmounts(volume)
self.assertIsInstance(mounts, list)
self.assertSetEqual(
set(mounts),
self.known_mounts & set(mounts),
)
try:
mounts = os.listmounts(volume)
except OSError as ex:
if support.verbose:
print("Skipping", volume, "because of", ex)
else:
self.assertIsInstance(mounts, list)
self.assertSetEqual(
set(mounts),
self.known_mounts & set(mounts),
)


@unittest.skipUnless(hasattr(os, 'readlink'), 'needs os.readlink()')
Expand Down

0 comments on commit 4af55ab

Please sign in to comment.