summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2019-05-30 00:13:12 (GMT)
committerBarry Warsaw <barry@python.org>2019-05-30 00:13:11 (GMT)
commit80878312316bfb4011157f13cf040f6d885f808b (patch)
tree6d3b9bda59377738f9b418c96e65ce990f6a9aa2 /Lib/test/test_importlib
parent29cb21ddb92413931e473eb799a02e2d8cdf4a45 (diff)
downloadcpython-80878312316bfb4011157f13cf040f6d885f808b.zip
cpython-80878312316bfb4011157f13cf040f6d885f808b.tar.gz
cpython-80878312316bfb4011157f13cf040f6d885f808b.tar.bz2
Don't crash if there exists an EGG-INFO directory on sys.path (#13667)
* Don't crash if there exists an EGG-INFO directory on sys.path cross-port of https://gitlab.com/python-devs/importlib_metadata/merge_requests/72 * Also catch PermissionError for windows
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/test_main.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_main.py b/Lib/test/test_importlib/test_main.py
index b70f944..844ed26 100644
--- a/Lib/test/test_importlib/test_main.py
+++ b/Lib/test/test_importlib/test_main.py
@@ -156,3 +156,11 @@ class DiscoveryTests(fixtures.EggInfoPkg,
dist.metadata['Name'] == 'distinfo-pkg'
for dist in dists
)
+
+
+class DirectoryTest(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
+ def test(self):
+ # make an `EGG-INFO` directory that's unrelated
+ self.site_dir.joinpath('EGG-INFO').mkdir()
+ # used to crash with `IsADirectoryError`
+ self.assertIsNone(version('unknown-package'))