Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Eryk Sun <eryksun@gmail.com>
  • Loading branch information
barneygale and eryksun authored Jan 8, 2023
commit 4bb81ee9d7a1c992302229d4d36465aab5acf96a
4 changes: 2 additions & 2 deletions Lib/test/support/os_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def __exit__(self, *ignore_exc):
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
except (ImportError, AttributeError):
def subst_drive(path):
raise NotImplementedError('ctypes or kernel32 is not available')
raise unittest.SkipTest('ctypes or kernel32 is not available')
else:
ERROR_FILE_NOT_FOUND = 2
DDD_REMOVE_DEFINITION = 2
Expand All @@ -740,7 +740,7 @@ def subst_drive(path):
ctypes.get_last_error() == ERROR_FILE_NOT_FOUND):
break
else:
raise FileExistsError('no available logical drive')
raise unittest.SkipTest('no available logical drive')
if not kernel32.DefineDosDeviceW(
DDD_NO_BROADCAST_SYSTEM, drive, path):
raise ctypes.WinError(ctypes.get_last_error())
Expand Down
6 changes: 4 additions & 2 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3014,8 +3014,10 @@ def test_absolute(self):

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

# Relative path on another drive
self.assertEqual(str(P(other_drive).absolute()), other_cwd)
Expand Down