mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #15338: skip test_UNC_path when the current user doesn't have enough permissions to access the path.
This commit is contained in:
commit
c27ace688c
1 changed files with 14 additions and 11 deletions
|
@ -464,9 +464,14 @@ class PathsTests(unittest.TestCase):
|
|||
drive = path[0]
|
||||
unc = "\\\\%s\\%s$"%(hn, drive)
|
||||
unc += path[2:]
|
||||
sys.path.insert(0, unc)
|
||||
try:
|
||||
os.listdir(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:
|
||||
|
@ -475,8 +480,6 @@ class PathsTests(unittest.TestCase):
|
|||
self.assertEqual(mod.testdata, 'test_unc_path')
|
||||
self.assertTrue(mod.__file__.startswith(unc), mod.__file__)
|
||||
unload("test_unc_path")
|
||||
finally:
|
||||
sys.path.remove(unc)
|
||||
|
||||
|
||||
class RelativeImportTests(unittest.TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue