Skip to content

Commit

Permalink
Added test coverage for convert_requires()
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Nov 7, 2024
1 parent 06beb7b commit 4bdf84e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions tests/cli/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,26 @@
===================
Test description
"""
)
).encode("utf-8")
REQUIRES_TXT = dedent(
"""\
somepackage>=1.5
otherpackage>=1.7
[:python_version < '3']
six
"""
).encode("utf-8")
EXPECTED_METADATA = dedent(
"""\
Metadata-Version: 2.4
Name: Sampledist
Version: 1.0.0
Author: Alex Grönholm
Author-email: [email protected]
Requires-Dist: somepackage>=1.5
Requires-Dist: otherpackage>=1.7
Requires-Dist: six; python_version < "3"
Sample Distribution
===================
Expand Down Expand Up @@ -107,14 +119,18 @@ def bdist_wininst_path(arch: str, pyver: str | None, tmp_path: Path) -> str:
)
zip.writestr(
f"{prefix}/Sampledist-1.0.0{pyver_suffix}.egg-info/PKG-INFO",
PKG_INFO.encode("utf-8"),
PKG_INFO,
)
zip.writestr(
f"{prefix}/Sampledist-1.0.0{pyver_suffix}.egg-info/SOURCES.txt", b""
)
zip.writestr(
f"{prefix}/Sampledist-1.0.0{pyver_suffix}.egg-info/top_level.txt", b""
)
zip.writestr(
f"{prefix}/Sampledist-1.0.0{pyver_suffix}.egg-info/requires.txt",
REQUIRES_TXT,
)
zip.writestr(f"{prefix}/Sampledist-1.0.0{pyver_suffix}.egg-info/zip-safe", b"")
zip.writestr("SCRIPTS/somecommand", b"#!python\nprint('hello')")

Expand All @@ -135,9 +151,10 @@ def egg_path(arch: str, pyver: str | None, tmp_path: Path) -> str:
zip.writestr("sampledist/__init__.py", b"")
zip.writestr(f"sampledist/_extmodule.cp37-{arch}.pyd", b"")
zip.writestr("EGG-INFO/dependency_links.txt", b"")
zip.writestr("EGG-INFO/PKG-INFO", PKG_INFO.encode("utf-8"))
zip.writestr("EGG-INFO/PKG-INFO", PKG_INFO)
zip.writestr("EGG-INFO/SOURCES.txt", b"")
zip.writestr("EGG-INFO/top_level.txt", b"")
zip.writestr("EGG-INFO/requires.txt", REQUIRES_TXT)
zip.writestr("EGG-INFO/zip-safe", b"")

return str(bdist_path)
Expand Down

0 comments on commit 4bdf84e

Please sign in to comment.