summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-01-26 08:26:14 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-01-26 08:26:14 (GMT)
commit5106d044ecd6d7a8124dd4b526b77588747e0167 (patch)
tree7a139df0a25590e08a05edcaf6b228002fd71cec /Lib/test/test_ntpath.py
parent624caf7bcb81c2ebe1b6be554a90a2b549e18c96 (diff)
downloadcpython-5106d044ecd6d7a8124dd4b526b77588747e0167.zip
cpython-5106d044ecd6d7a8124dd4b526b77588747e0167.tar.gz
cpython-5106d044ecd6d7a8124dd4b526b77588747e0167.tar.bz2
Issue #7665: Fixed tests test_ntpath and test_urllib2 when ran in the
directory containing a backslash.
Diffstat (limited to 'Lib/test/test_ntpath.py')
-rw-r--r--Lib/test/test_ntpath.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 376f7ed..c8d84a7 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -306,13 +306,14 @@ class TestNtpath(unittest.TestCase):
self.skipTest('nt module not available')
def test_relpath(self):
- currentdir = os.path.split(os.getcwd())[-1]
tester('ntpath.relpath("a")', 'a')
tester('ntpath.relpath(os.path.abspath("a"))', 'a')
tester('ntpath.relpath("a/b")', 'a\\b')
tester('ntpath.relpath("../a/b")', '..\\a\\b')
- tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
- tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b')
+ with support.temp_cwd(support.TESTFN) as cwd_dir:
+ currentdir = os.path.basename(cwd_dir)
+ tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a')
+ tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b')
tester('ntpath.relpath("a", "b/c")', '..\\..\\a')
tester('ntpath.relpath("c:/foo/bar/bat", "c:/x/y")', '..\\..\\foo\\bar\\bat')
tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a')