summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-01-24 10:50:45 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-01-24 10:50:45 (GMT)
commitd9aab51945b7ecc260a4d388f39b033247b838cc (patch)
tree41dcd5ac15bbe25c8750ef94b0570b0bdc26b628 /Lib/test
parent92cb4384481417d07344d97071df8e9734f1463b (diff)
downloadcpython-d9aab51945b7ecc260a4d388f39b033247b838cc.zip
cpython-d9aab51945b7ecc260a4d388f39b033247b838cc.tar.gz
cpython-d9aab51945b7ecc260a4d388f39b033247b838cc.tar.bz2
Add a test for UNC import paths, see issue 3677
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_import.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 145ff9a..d30f905 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -346,6 +346,27 @@ class PathsTests(unittest.TestCase):
self.assertEqual(mod.testdata, 'test_trailing_slash')
unload("test_trailing_slash")
+ # http://bugs.python.org/issue3677
+ def _test_UNC_path(self):
+ f = open(os.path.join(self.path, 'test_trailing_slash.py'), 'w')
+ f.write("testdata = 'test_trailing_slash'")
+ f.close()
+ #create the UNC path, like \\myhost\c$\foo\bar
+ path = os.path.abspath(self.path)
+ import socket
+ hn = socket.gethostname()
+ drive = path[0]
+ unc = "\\\\%s\\%s$"%(hn, drive)
+ unc += path[2:]
+ sys.path.append(path)
+ mod = __import__("test_trailing_slash")
+ self.assertEqual(mod.testdata, 'test_trailing_slash')
+ unload("test_trailing_slash")
+
+ if sys.platform == "win32":
+ test_UNC_path = _test_UNC_path
+
+
class RelativeImport(unittest.TestCase):
def tearDown(self):
try: