Skip to content

Commit 913c02f

Browse files
move directory metadata test out of req install tests
1 parent a2ad46f commit 913c02f

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

tests/unit/metadata/test_metadata.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,17 @@ def test_dist_found_in_zip(tmp_path: Path) -> None:
129129
dist = get_environment([location]).get_distribution("pkg")
130130
assert dist is not None and dist.location is not None
131131
assert Path(dist.location) == Path(location)
132+
133+
134+
@pytest.mark.parametrize(
135+
"path",
136+
(
137+
"/path/to/foo.egg-info".replace("/", os.path.sep),
138+
# Tests issue fixed by https://github.com/pypa/pip/pull/2530
139+
"/path/to/foo.egg-info/".replace("/", os.path.sep),
140+
),
141+
)
142+
def test_trailing_slash_directory_metadata(path: str) -> None:
143+
dist = get_directory_distribution(path)
144+
assert dist.raw_name == dist.canonical_name == "foo"
145+
assert dist.location == "/path/to".replace("/", os.path.sep)

tests/unit/test_req.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
PreviousBuildDirError,
2424
)
2525
from pip._internal.index.package_finder import PackageFinder
26-
from pip._internal.metadata import select_backend
2726
from pip._internal.models.direct_url import ArchiveInfo, DirectUrl, DirInfo, VcsInfo
2827
from pip._internal.models.link import Link
2928
from pip._internal.network.session import PipSession
@@ -600,22 +599,6 @@ def test_url_preserved_editable_req(self) -> None:
600599
assert req.link is not None
601600
assert req.link.url == url
602601

603-
@pytest.mark.parametrize(
604-
"path",
605-
(
606-
"/path/to/foo.egg-info".replace("/", os.path.sep),
607-
# Tests issue fixed by https://github.com/pypa/pip/pull/2530
608-
"/path/to/foo.egg-info/".replace("/", os.path.sep),
609-
),
610-
)
611-
def test_get_dist(self, path: str) -> None:
612-
req = install_req_from_line("foo")
613-
req.metadata_directory = path
614-
dist = req.get_dist()
615-
assert isinstance(dist, select_backend().Distribution)
616-
assert dist.raw_name == dist.canonical_name == "foo"
617-
assert dist.location == "/path/to".replace("/", os.path.sep)
618-
619602
def test_markers(self) -> None:
620603
for line in (
621604
# recommended syntax

0 commit comments

Comments
 (0)