Skip to content

Commit

Permalink
Test for a multi-line License header
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Nov 7, 2024
1 parent f45026e commit 5b4a98c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: requirements-txt-fixer
- id: trailing-whitespace
exclude: "tests/cli/test_convert.py"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build-backend = "flit_core.buildapi"
name = "wheel"
description = "A built-package format for Python"
readme = "README.rst"
license = {file = "LICENSE.txt"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand Down
90 changes: 49 additions & 41 deletions tests/cli/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,56 @@
from wheel.cli.convert import convert, egg_filename_re
from wheel.wheelfile import WHEEL_INFO_RE, WheelFile

PKG_INFO = dedent(
"""\
Metadata-Version: 2.1
Name: Sampledist
Version: 1.0.0
Author: Alex Grönholm
Author-email: [email protected]
Home-page: https://example.com
Download-URL: https://example.com/sampledist
Description: Sample Distribution
===================
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]
Project-URL: Homepage, https://example.com
Project-URL: Download, https://example.com/sampledist
Requires-Dist: somepackage>=1.5
Requires-Dist: otherpackage>=1.7
Requires-Dist: six; python_version < "3"
Sample Distribution
PKG_INFO = """\
Metadata-Version: 2.1
Name: Sampledist
Version: 1.0.0
Author: Alex Grönholm
Author-email: [email protected]
Home-page: https://example.com
Download-URL: https://example.com/sampledist
License: Sample license text
second row
third row
fourth row
Description: Sample Distribution
===================
Test description
"""
).encode("utf-8")
Test description
""".encode() # noqa: W293

REQUIRES_TXT = b"""\
somepackage>=1.5
otherpackage>=1.7
[:python_version < '3']
six
"""

EXPECTED_METADATA = """\
Metadata-Version: 2.4
Name: Sampledist
Version: 1.0.0
Author: Alex Grönholm
Author-email: [email protected]
Project-URL: Homepage, https://example.com
Project-URL: Download, https://example.com/sampledist
License: Sample license text
second row
third row
fourth row
Requires-Dist: somepackage>=1.5
Requires-Dist: otherpackage>=1.7
Requires-Dist: six; python_version < "3"
Sample Distribution
===================
Test description
""".encode() # noqa: W293


@pytest.fixture(
Expand Down

0 comments on commit 5b4a98c

Please sign in to comment.