Skip to content

Commit

Permalink
fix: configuration error printout missing values
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Apr 8, 2024
1 parent 4ae8347 commit 10cba9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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

0 comments on commit 10cba9d

Please sign in to comment.