Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16cd19c

Browse files
committed
Issue #22834: Fix a failing test under Solaris due to the platform not
allowing the deletion of the cwd. Thanks to Martin Panter for the initial fix.
1 parent abbf0f4 commit 16cd19c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/test/test_importlib/import_/test_path.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,14 @@ def find_spec(self, fullname, target=None):
163163
def test_deleted_cwd(self):
164164
# Issue #22834
165165
self.addCleanup(os.chdir, os.getcwd())
166-
with tempfile.TemporaryDirectory() as path:
167-
os.chdir(path)
166+
try:
167+
with tempfile.TemporaryDirectory() as path:
168+
os.chdir(path)
169+
except OSError as exc:
170+
if exc.errno == 22:
171+
# issue #22834
172+
self.skipTest("platform does not allow the deletion of the cwd")
173+
raise
168174
with util.import_state(path=['']):
169175
# Do not want FileNotFoundError raised.
170176
self.assertIsNone(self.machinery.PathFinder.find_spec('whatever'))

0 commit comments

Comments
 (0)