summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-01-24 10:52:26 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-01-24 10:52:26 (GMT)
commit89e759d462ac9bb3463f5ff7a3f8e123af380edb (patch)
tree81ee31696575c057fe4ef01667f37ae19e5cdf63
parent466bd9d3af89e713840a86ba3079353da0659304 (diff)
downloadcpython-89e759d462ac9bb3463f5ff7a3f8e123af380edb.zip
cpython-89e759d462ac9bb3463f5ff7a3f8e123af380edb.tar.gz
cpython-89e759d462ac9bb3463f5ff7a3f8e123af380edb.tar.bz2
Add a test for UNC import paths, see issue 3677
-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 db9c8ef..e107931 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -344,6 +344,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: