Skip to content
Merged
Prev Previous commit
Next Next commit
Tidy up test code slightly
  • Loading branch information
barneygale committed Jan 8, 2023
commit b19e6a072007f9e2011e30770a02e840a741a0f4
7 changes: 3 additions & 4 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3013,17 +3013,16 @@ def test_absolute(self):
self.assertEqual(str(P(drive + 'foo').absolute()), os.path.join(BASE, 'foo'))

with os_helper.subst_drive(BASE) as other_drive:
# Set the working directory on the substitute drive
saved_cwd = os.getcwd()
other_cwd = f'{other_drive}\\dirA'
# set the working directory on the substitute drive
saved_dir = os.getcwd()
os.chdir(other_cwd)
os.chdir(saved_dir)
os.chdir(saved_cwd)

# Relative path on another drive
self.assertEqual(str(P(other_drive).absolute()), other_cwd)
self.assertEqual(str(P(other_drive + 'foo').absolute()), other_cwd + '\\foo')


def test_glob(self):
P = self.cls
p = P(BASE)
Expand Down