diff options
author | Steve Dower <steve.dower@python.org> | 2023-03-15 00:07:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 00:07:30 (GMT) |
commit | 5fce813d8e547d6508daa386b67f230105c3a174 (patch) | |
tree | 757f406cafc0f0fffe77e81b788941e29880a34c /Lib/test | |
parent | 0a539b5db312d126ff45dd4aa6a53d40a292c512 (diff) | |
download | cpython-5fce813d8e547d6508daa386b67f230105c3a174.zip cpython-5fce813d8e547d6508daa386b67f230105c3a174.tar.gz cpython-5fce813d8e547d6508daa386b67f230105c3a174.tar.bz2 |
gh-102519: Avoid failing tests due to inaccessible volumes (GH-102706)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_os.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 253e2a2..42357fe 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2683,12 +2683,17 @@ class Win32ListdriveTests(unittest.TestCase): 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()') |