diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-07-12 17:48:49 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-07-12 17:48:49 (GMT) |
commit | f189e80f23bba5b793b3792cfb13bd6d61728b68 (patch) | |
tree | a3a96bc6a62b5251af66545dedac9bca1aa0cc5f /Lib | |
parent | 021548cf4c65bf6b87bf9916c52fe7c3694dd408 (diff) | |
download | cpython-f189e80f23bba5b793b3792cfb13bd6d61728b68.zip cpython-f189e80f23bba5b793b3792cfb13bd6d61728b68.tar.gz cpython-f189e80f23bba5b793b3792cfb13bd6d61728b68.tar.bz2 |
Small improvements to test_unc_path
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_import.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index ed60008..a38273c 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -454,8 +454,8 @@ class PathsTests(unittest.TestCase): # Regression test for http://bugs.python.org/issue3677. @unittest.skipUnless(sys.platform == 'win32', 'Windows-specific') def test_UNC_path(self): - with open(os.path.join(self.path, 'test_trailing_slash.py'), 'w') as f: - f.write("testdata = 'test_trailing_slash'") + with open(os.path.join(self.path, 'test_unc_path.py'), 'w') as f: + f.write("testdata = 'test_unc_path'") importlib.invalidate_caches() # Create the UNC path, like \\myhost\c$\foo\bar. path = os.path.abspath(self.path) @@ -464,15 +464,16 @@ class PathsTests(unittest.TestCase): drive = path[0] unc = "\\\\%s\\%s$"%(hn, drive) unc += path[2:] - sys.path.append(unc) + sys.path.insert(0, unc) try: try: - mod = __import__("test_trailing_slash") + mod = __import__("test_unc_path") except ImportError as e: - self.fail("could not import 'test_trailing_slash' from %r: %r" + self.fail("could not import 'test_unc_path' from %r: %r" % (unc, e)) - self.assertEqual(mod.testdata, 'test_trailing_slash') - unload("test_trailing_slash") + self.assertEqual(mod.testdata, 'test_unc_path') + self.assertTrue(mod.__file__.startswith(unc), mod.__file__) + unload("test_unc_path") finally: sys.path.remove(unc) |