Skip to content

Commit ba14bfd

Browse files
committed
TST: Adapt to changes in pyproject-metadata 0.8.0
1 parent 18981b3 commit ba14bfd

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

tests/test_metadata.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
import pathlib
6+
import re
67

78
import packaging.version
89
import pyproject_metadata
@@ -48,5 +49,10 @@ def test_missing_version(package_missing_version):
4849
pyproject = {'project': {
4950
'name': 'missing-version',
5051
}}
51-
with pytest.raises(pyproject_metadata.ConfigurationError, match='Required "project.version" field is missing'):
52+
match = '|'.join((
53+
re.escape('Required "project.version" field is missing'),
54+
# pyproject-metatadata 0.8.0 and later
55+
re.escape('Field "project.version" missing and "version" not specified in "project.dynamic"'),
56+
))
57+
with pytest.raises(pyproject_metadata.ConfigurationError, match=match):
5258
Metadata.from_pyproject(pyproject, pathlib.Path())

tests/test_sdist.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
import os
6+
import re
67
import stat
78
import sys
89
import tarfile
@@ -30,7 +31,7 @@ def test_pep621(sdist_full_metadata):
3031
with tarfile.open(sdist_full_metadata, 'r:gz') as sdist:
3132
sdist_pkg_info = sdist.extractfile('full_metadata-1.2.3/PKG-INFO').read().decode()
3233

33-
assert sdist_pkg_info == textwrap.dedent('''\
34+
metadata = re.escape(textwrap.dedent('''\
3435
Metadata-Version: 2.1
3536
Name: full-metadata
3637
Version: 1.2.3
@@ -65,7 +66,11 @@ def test_pep621(sdist_full_metadata):
6566
# full-metadata
6667
6768
An example package with all of the PEP 621 metadata!
68-
''')
69+
'''))
70+
71+
# pyproject-metadata 0.8.0 and later uses a comma to separate keywords
72+
expr = metadata.replace(r'Keywords:\ full\ metadata', r'Keywords:\ full[ ,]metadata')
73+
assert re.fullmatch(expr, sdist_pkg_info)
6974

7075

7176
def test_dynamic_version(sdist_dynamic_version):

0 commit comments

Comments
 (0)