diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-07-13 18:59:19 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-07-13 18:59:19 (GMT) |
commit | c27ace688c91c3e52f66c0ff4b4c00f674912943 (patch) | |
tree | 2793e2b498ce507e8f3c6afecb4f2dcd79ef5bfb /Lib/test/test_import.py | |
parent | d104eef118bda30725ac087e06252a5a3525e2df (diff) | |
parent | 68f4247b656148f7998cda856e3f77b0360a3c9c (diff) | |
download | cpython-c27ace688c91c3e52f66c0ff4b4c00f674912943.zip cpython-c27ace688c91c3e52f66c0ff4b4c00f674912943.tar.gz cpython-c27ace688c91c3e52f66c0ff4b4c00f674912943.tar.bz2 |
Issue #15338: skip test_UNC_path when the current user doesn't have enough permissions to access the path.
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 61fea78..89ec8dc 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -464,19 +464,22 @@ class PathsTests(unittest.TestCase): drive = path[0] unc = "\\\\%s\\%s$"%(hn, drive) unc += path[2:] - sys.path.insert(0, unc) try: os.listdir(unc) - try: - mod = __import__("test_unc_path") - except ImportError as e: - self.fail("could not import 'test_unc_path' from %r: %r" - % (unc, e)) - self.assertEqual(mod.testdata, 'test_unc_path') - self.assertTrue(mod.__file__.startswith(unc), mod.__file__) - unload("test_unc_path") - finally: - sys.path.remove(unc) + except OSError as e: + if e.errno in (errno.EPERM, errno.EACCES): + # See issue #15338 + self.skipTest("cannot access administrative share %r" % (unc,)) + raise + sys.path.insert(0, unc) + try: + mod = __import__("test_unc_path") + except ImportError as e: + self.fail("could not import 'test_unc_path' from %r: %r" + % (unc, e)) + self.assertEqual(mod.testdata, 'test_unc_path') + self.assertTrue(mod.__file__.startswith(unc), mod.__file__) + unload("test_unc_path") class RelativeImportTests(unittest.TestCase): |