From: Brett Cannon Date: Fri, 20 Feb 2015 14:48:18 +0000 (-0500) Subject: Issue #22834: Fix a failing test under Solaris due to the platform not X-Git-Tag: v3.5.0a2~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16cd19c8a2c7ceaa03312836003e40fc79915161;p=python 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. --- diff --git a/Lib/test/test_importlib/import_/test_path.py b/Lib/test/test_importlib/import_/test_path.py index 9a3c4fe877..f257f117b4 100644 --- a/Lib/test/test_importlib/import_/test_path.py +++ b/Lib/test/test_importlib/import_/test_path.py @@ -163,8 +163,14 @@ class FinderTests: def test_deleted_cwd(self): # Issue #22834 self.addCleanup(os.chdir, os.getcwd()) - with tempfile.TemporaryDirectory() as path: - os.chdir(path) + try: + with tempfile.TemporaryDirectory() as path: + os.chdir(path) + except OSError as exc: + if exc.errno == 22: + # issue #22834 + self.skipTest("platform does not allow the deletion of the cwd") + raise with util.import_state(path=['']): # Do not want FileNotFoundError raised. self.assertIsNone(self.machinery.PathFinder.find_spec('whatever'))