mirror of https://github.com/pypa/pip
move directory metadata test out of req install tests
This commit is contained in:
parent
e86da734c7
commit
67ff36b838
|
@ -129,3 +129,17 @@ def test_dist_found_in_zip(tmp_path: Path) -> None:
|
|||
dist = get_environment([location]).get_distribution("pkg")
|
||||
assert dist is not None and dist.location is not None
|
||||
assert Path(dist.location) == Path(location)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path",
|
||||
(
|
||||
"/path/to/foo.egg-info".replace("/", os.path.sep),
|
||||
# Tests issue fixed by https://github.com/pypa/pip/pull/2530
|
||||
"/path/to/foo.egg-info/".replace("/", os.path.sep),
|
||||
),
|
||||
)
|
||||
def test_trailing_slash_directory_metadata(path: str) -> None:
|
||||
dist = get_directory_distribution(path)
|
||||
assert dist.raw_name == dist.canonical_name == "foo"
|
||||
assert dist.location == "/path/to".replace("/", os.path.sep)
|
||||
|
|
|
@ -23,7 +23,6 @@ from pip._internal.exceptions import (
|
|||
PreviousBuildDirError,
|
||||
)
|
||||
from pip._internal.index.package_finder import PackageFinder
|
||||
from pip._internal.metadata import select_backend
|
||||
from pip._internal.models.direct_url import ArchiveInfo, DirectUrl, DirInfo, VcsInfo
|
||||
from pip._internal.models.link import Link
|
||||
from pip._internal.network.session import PipSession
|
||||
|
@ -600,22 +599,6 @@ class TestInstallRequirement:
|
|||
assert req.link is not None
|
||||
assert req.link.url == url
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"path",
|
||||
(
|
||||
"/path/to/foo.egg-info".replace("/", os.path.sep),
|
||||
# Tests issue fixed by https://github.com/pypa/pip/pull/2530
|
||||
"/path/to/foo.egg-info/".replace("/", os.path.sep),
|
||||
),
|
||||
)
|
||||
def test_get_dist(self, path: str) -> None:
|
||||
req = install_req_from_line("foo")
|
||||
req.metadata_directory = path
|
||||
dist = req.get_dist()
|
||||
assert isinstance(dist, select_backend().Distribution)
|
||||
assert dist.raw_name == dist.canonical_name == "foo"
|
||||
assert dist.location == "/path/to".replace("/", os.path.sep)
|
||||
|
||||
def test_markers(self) -> None:
|
||||
for line in (
|
||||
# recommended syntax
|
||||
|
|
Loading…
Reference in New Issue