From: Steve Dower Date: Wed, 15 Mar 2023 00:07:30 +0000 (+0000) Subject: gh-102519: Avoid failing tests due to inaccessible volumes (GH-102706) X-Git-Tag: v3.12.0a7~172 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5fce813d8e547d6508daa386b67f230105c3a174;p=thirdparty%2FPython%2Fcpython.git gh-102519: Avoid failing tests due to inaccessible volumes (GH-102706) --- diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 253e2a23238f..42357fef80ec 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()')