[Python-checkins] cpython: Issue #22834: Fix a failing test under Solaris due to the platform not

brett.cannon python-checkins at python.org
Fri Feb 20 15:48:29 CET 2015


https://hg.python.org/cpython/rev/f4f2096ab6f8
changeset:   94700:f4f2096ab6f8
user:        Brett Cannon <brett at python.org>
date:        Fri Feb 20 09:48:18 2015 -0500
summary:
  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.

files:
  Lib/test/test_importlib/import_/test_path.py |  10 ++++++++--
  1 files changed, 8 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_importlib/import_/test_path.py b/Lib/test/test_importlib/import_/test_path.py
--- a/Lib/test/test_importlib/import_/test_path.py
+++ b/Lib/test/test_importlib/import_/test_path.py
@@ -163,8 +163,14 @@
     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'))

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list