Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: configuration error printout missing values #99

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def from_pyproject(
raise ConfigurationError(msg)

if metadata_version and metadata_version not in KNOWN_METADATA_VERSIONS:
msg = 'The metadata_version must be one of {KNOWN_METADATA_VERSIONS} or None (default)'
msg = f'The metadata_version must be one of {KNOWN_METADATA_VERSIONS} or None (default)'
raise ConfigurationError(msg)

return cls(
Expand Down
15 changes: 15 additions & 0 deletions tests/test_standard_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,21 @@ def test_as_rfc822_set_metadata(metadata_version):
assert 'Requires-Dist: some-package; extra == "da-sh"' in rfc822
assert 'Requires-Dist: some.package; extra == "do-t"' in rfc822

def test_as_rfc822_set_metadata_invalid():
with pytest.raises(pyproject_metadata.ConfigurationError, match='The metadata_version must be one of') as err:
pyproject_metadata.StandardMetadata.from_pyproject(
{
'project': {
'name': 'hi',
'version': '1.2',
},
},
metadata_version='2.0',
)
assert '2.1' in str(err.value)
assert '2.2' in str(err.value)
assert '2.3' in str(err.value)


def test_as_rfc822_invalid_dynamic():
metadata = pyproject_metadata.StandardMetadata(
Expand Down
Loading