summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-01-26 08:26:00 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-01-26 08:26:00 (GMT)
commit38a33ec44cc4590f2e2e9fe7aaf8bd63d4ab24e0 (patch)
treeda40afe9298176fd7723a1d9b61f1ea479171a14 /Lib/test/test_ntpath.py
parente8c9e14af9bd9f2ced50e8b6535e45f0d33d8e72 (diff)
downloadcpython-38a33ec44cc4590f2e2e9fe7aaf8bd63d4ab24e0.zip
cpython-38a33ec44cc4590f2e2e9fe7aaf8bd63d4ab24e0.tar.gz
cpython-38a33ec44cc4590f2e2e9fe7aaf8bd63d4ab24e0.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 7b5f7bb..0fbe6a1 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -281,13 +281,14 @@ class TestNtpath(unittest.TestCase):
tester('ntpath.abspath("C:\\")', "C:\\")
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 test_support.temp_cwd(test_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("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a')
tester('ntpath.relpath("a", "a")', '.')