Skip to content

Commit b9e0b58

Browse files
gh-156707: Remove the junction created in test_realpath_volume_guid_path()
The junction pointed to a volume without a mount point. It was left for the temporary directory cleanup, which descended into it and tried to remove files on that volume.
1 parent 3f29269 commit b9e0b58

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Lib/test/test_ntpath.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,11 +1546,15 @@ def test_realpath_volume_guid_path(self):
15461546
except (OSError, subprocess.CalledProcessError):
15471547
raise unittest.SkipTest('creating the test junction failed')
15481548

1549-
for path in 'testjunc', 'testjunc/spam', 'testjunc/spam/eggs':
1550-
with self.subTest(path=path):
1551-
realpath = ntpath.realpath(path)
1552-
self.assertStartsWith(realpath, '\\\\?\\Volume{')
1553-
self.assertTrue(ntpath.isabs(realpath), realpath)
1549+
try:
1550+
for path in 'testjunc', 'testjunc/spam', 'testjunc/spam/eggs':
1551+
with self.subTest(path=path):
1552+
realpath = ntpath.realpath(path)
1553+
self.assertStartsWith(realpath, '\\\\?\\Volume{')
1554+
self.assertTrue(ntpath.isabs(realpath), realpath)
1555+
finally:
1556+
# Remove the junction, not the volume it points to.
1557+
os_helper.rmdir('testjunc')
15541558

15551559
def test_isfile_invalid_paths(self):
15561560
isfile = ntpath.isfile

0 commit comments

Comments
 (0)