Skip to content

Commit f737c67

Browse files
committed
TST: adjust for changes in pyproject-metadata 0.9.0
1 parent 35f2842 commit f737c67

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/test_metadata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def test_missing_version(package_missing_version):
5353
re.escape('Required "project.version" field is missing'),
5454
# pyproject-metatadata 0.8.0 and later
5555
re.escape('Field "project.version" missing and "version" not specified in "project.dynamic"'),
56+
# pyproject-metatadata 0.9.0 and later
57+
re.escape('Field "project.version" missing and \'version\' not specified in "project.dynamic"'),
5658
))
5759
with pytest.raises(pyproject_metadata.ConfigurationError, match=match):
5860
Metadata.from_pyproject(pyproject, pathlib.Path())

tests/test_sdist.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@
1717

1818
from .conftest import in_git_repo_context
1919

20+
import packaging
21+
import pyproject_metatada
22+
23+
if packaging.version.Version(pyproject_metadata.__version__) < packaging.version.Version('0.9a0'):
24+
_normalize = lambda x: x
25+
else:
26+
_normalize = lambda x: x.replace('\n\n', '\n')
27+
2028

2129
def test_no_pep621(sdist_library):
2230
with tarfile.open(sdist_library, 'r:gz') as sdist:
2331
sdist_pkg_info = sdist.extractfile('library-1.0.0/PKG-INFO').read().decode()
2432

25-
assert sdist_pkg_info == textwrap.dedent('''\
33+
assert _normalize(sdist_pkg_info) == _metadata('''\
2634
Metadata-Version: 2.1
2735
Name: library
2836
Version: 1.0.0
@@ -79,7 +87,7 @@ def test_dynamic_version(sdist_dynamic_version):
7987
with tarfile.open(sdist_dynamic_version, 'r:gz') as sdist:
8088
sdist_pkg_info = sdist.extractfile('dynamic_version-1.0.0/PKG-INFO').read().decode()
8189

82-
assert sdist_pkg_info == textwrap.dedent('''\
90+
assert _normalize(sdist_pkg_info) == textwrap.dedent('''\
8391
Metadata-Version: 2.1
8492
Name: dynamic-version
8593
Version: 1.0.0

0 commit comments

Comments
 (0)