summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2015-02-20 14:48:18 (GMT)
committerBrett Cannon <brett@python.org>2015-02-20 14:48:18 (GMT)
commit16cd19c8a2c7ceaa03312836003e40fc79915161 (patch)
treec661b331368806f396bc57d319979adce0480695 /Lib/test/test_importlib
parentabbf0f40bb91be45b282c7a95161297b2618622a (diff)
downloadcpython-16cd19c8a2c7ceaa03312836003e40fc79915161.zip
cpython-16cd19c8a2c7ceaa03312836003e40fc79915161.tar.gz
cpython-16cd19c8a2c7ceaa03312836003e40fc79915161.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/import_/test_path.py10
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
index 9a3c4fe..f257f11 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'))