diff options
Diffstat (limited to 'pkg_resources')
| -rw-r--r-- | pkg_resources/__init__.py | 5 | ||||
| -rw-r--r-- | pkg_resources/tests/test_pkg_resources.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 0575a989..0512731d 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2072,7 +2072,10 @@ def dist_factory(path_item, entry, only): """Return a dist_factory for the given entry.""" lower = entry.lower() is_egg_info = lower.endswith('.egg-info') - is_dist_info = lower.endswith('.dist-info') and not os.path.isfile(entry) + is_dist_info = ( + lower.endswith('.dist-info') and + os.path.isdir(os.path.join(path_item, entry)) + ) is_meta = is_egg_info or is_dist_info return ( distributions_from_metadata diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 9991402c..189a8668 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -335,7 +335,7 @@ def test_dist_info_is_not_dir(tmp_path, only): """Test path containing a file with dist-info extension.""" dist_info = tmp_path / 'foobar.dist-info' dist_info.touch() - assert not pkg_resources.dist_factory(None, str(dist_info), only) + assert not pkg_resources.dist_factory(str(tmp_path), str(dist_info), only) class TestDeepVersionLookupDistutils: |
