File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -306,13 +306,14 @@ def test_abspath(self):
306306 self .skipTest ('nt module not available' )
307307
308308 def test_relpath (self ):
309- currentdir = os .path .split (os .getcwd ())[- 1 ]
310309 tester ('ntpath.relpath("a")' , 'a' )
311310 tester ('ntpath.relpath(os.path.abspath("a"))' , 'a' )
312311 tester ('ntpath.relpath("a/b")' , 'a\\ b' )
313312 tester ('ntpath.relpath("../a/b")' , '..\\ a\\ b' )
314- tester ('ntpath.relpath("a", "../b")' , '..\\ ' + currentdir + '\\ a' )
315- tester ('ntpath.relpath("a/b", "../c")' , '..\\ ' + currentdir + '\\ a\\ b' )
313+ with support .temp_cwd (support .TESTFN ) as cwd_dir :
314+ currentdir = os .path .basename (cwd_dir )
315+ tester ('ntpath.relpath("a", "../b")' , '..\\ ' + currentdir + '\\ a' )
316+ tester ('ntpath.relpath("a/b", "../c")' , '..\\ ' + currentdir + '\\ a\\ b' )
316317 tester ('ntpath.relpath("a", "b/c")' , '..\\ ..\\ a' )
317318 tester ('ntpath.relpath("c:/foo/bar/bat", "c:/x/y")' , '..\\ ..\\ foo\\ bar\\ bat' )
318319 tester ('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")' , '..\\ ..\\ a' )
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def test_trivial(self):
4444 self .assertRaises (ValueError , urllib .request .urlopen , 'bogus url' )
4545
4646 # XXX Name hacking to get this to work on Windows.
47- fname = os .path .abspath (urllib .request .__file__ ).replace (' \\ ' , '/' )
47+ fname = os .path .abspath (urllib .request .__file__ ).replace (os . sep , '/' )
4848
4949 if os .name == 'nt' :
5050 file_url = "file:///%s" % fname
You can’t perform that action at this time.
0 commit comments