mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
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
This commit is contained in:
parent
29cb21ddb9
commit
8087831231
2 changed files with 10 additions and 1 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue