Skip to content

Commit

Permalink
metadata version forwards compatibility (#9095)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Mar 4, 2024
1 parent 2f6a553 commit 43c2639
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/masonry/builders/test_editable_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from cleo.io.null_io import NullIO
from deepdiff import DeepDiff
from poetry.core.constraints.version import Version
from poetry.core.masonry.metadata import Metadata
from poetry.core.packages.package import Package

from poetry.factory import Factory
Expand Down Expand Up @@ -100,6 +101,13 @@ def bad_scripts_too_many_colon(fixture_dir: FixtureDirGetter) -> Poetry:
return poetry


def expected_metadata_version() -> str:
# Get the metadata version that we should expect: which is poetry-core's default
# value.
metadata = Metadata()
return metadata.metadata_version


def test_builder_installs_proper_files_for_standard_packages(
simple_poetry: Poetry, tmp_venv: VirtualEnv
) -> None:
Expand Down Expand Up @@ -147,8 +155,9 @@ def test_builder_installs_proper_files_for_standard_packages(
key=lambda x: tuple(map(int, x.split("."))),
)
)
metadata_version = expected_metadata_version()
metadata = f"""\
Metadata-Version: 2.1
Metadata-Version: {metadata_version}
Name: simple-project
Version: 1.2.3
Summary: Some description.
Expand Down Expand Up @@ -314,8 +323,9 @@ def test_builder_generates_proper_metadata_when_multiple_readme_files(
dist_info = tmp_venv.site_packages.find(dist_info)[0]
assert dist_info.joinpath("METADATA").exists()

metadata = """\
Metadata-Version: 2.1
metadata_version = expected_metadata_version()
metadata = f"""\
Metadata-Version: {metadata_version}
Name: my-package
Version: 0.1
Summary: Some description.
Expand Down

0 comments on commit 43c2639

Please # to comment.