Commit 2dc26715 by Sébastien Eustace Committed by GitHub

Fix support for egg files in InstalledRepository (#1577)

parent ad40e5bc
......@@ -2,6 +2,7 @@
# Packages
*.egg
!/tests/**/*.egg
/*.egg-info
/tests/fixtures/**/*.egg-info
/dist/*
......
......@@ -27,7 +27,7 @@ class InstalledRepository(Repository):
repo.add_package(package)
path = Path(distribution._path)
path = Path(str(distribution._path))
is_standard_package = True
try:
path.relative_to(env.site_packages)
......
import zipp
from importlib_metadata import PathDistribution
from poetry.repositories.installed_repository import InstalledRepository
from poetry.utils._compat import Path
......@@ -11,6 +13,7 @@ SRC = ENV_DIR / "src"
INSTALLED_RESULTS = [
PathDistribution(SITE_PACKAGES / "cleo-0.7.6.dist-info"),
PathDistribution(SRC / "pendulum" / "pendulum.egg-info"),
PathDistribution(zipp.Path(str(SITE_PACKAGES / "foo-0.1.0-py3.8.egg"), "EGG-INFO")),
]
......@@ -37,7 +40,7 @@ def test_load(mocker):
)
repository = InstalledRepository.load(MockEnv(path=ENV_DIR))
assert len(repository.packages) == 2
assert len(repository.packages) == 3
cleo = repository.packages[0]
assert cleo.name == "cleo"
......@@ -47,7 +50,11 @@ def test_load(mocker):
== "Cleo allows you to create beautiful and testable command-line interfaces."
)
pendulum = repository.packages[1]
foo = repository.packages[1]
assert foo.name == "foo"
assert foo.version.text == "0.1.0"
pendulum = repository.packages[2]
assert pendulum.name == "pendulum"
assert pendulum.version.text == "2.0.5"
assert pendulum.description == "Python datetimes made easy"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment