summaryrefslogtreecommitdiff
path: root/dev-python/meson-python/files/meson-python-0.16.0-pyproject-metadata-0.8.patch
blob: 834aed4d2fb41b87b2a175dc30a5e7dadee5e664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From ba14bfdffceb571a5e8c1406c76b7b77634bcb7f Mon Sep 17 00:00:00 2001
From: Daniele Nicolodi <daniele@grinta.net>
Date: Mon, 15 Apr 2024 22:34:36 +0200
Subject: [PATCH 2/2] TST: Adapt to changes in pyproject-metadata 0.8.0

---
 tests/test_metadata.py | 8 +++++++-
 tests/test_sdist.py    | 9 +++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/test_metadata.py b/tests/test_metadata.py
index 0c278da6..088e82f7 100644
--- a/tests/test_metadata.py
+++ b/tests/test_metadata.py
@@ -3,6 +3,7 @@
 # SPDX-License-Identifier: MIT
 
 import pathlib
+import re
 
 import packaging.version
 import pyproject_metadata
@@ -48,5 +49,10 @@ def test_missing_version(package_missing_version):
     pyproject = {'project': {
         'name': 'missing-version',
     }}
-    with pytest.raises(pyproject_metadata.ConfigurationError, match='Required "project.version" field is missing'):
+    match = '|'.join((
+        re.escape('Required "project.version" field is missing'),
+        # pyproject-metatadata 0.8.0 and later
+        re.escape('Field "project.version" missing and "version" not specified in "project.dynamic"'),
+    ))
+    with pytest.raises(pyproject_metadata.ConfigurationError, match=match):
         Metadata.from_pyproject(pyproject, pathlib.Path())
diff --git a/tests/test_sdist.py b/tests/test_sdist.py
index 6e337617..fb698b53 100644
--- a/tests/test_sdist.py
+++ b/tests/test_sdist.py
@@ -3,6 +3,7 @@
 # SPDX-License-Identifier: MIT
 
 import os
+import re
 import stat
 import sys
 import tarfile
@@ -30,7 +31,7 @@ def test_pep621(sdist_full_metadata):
     with tarfile.open(sdist_full_metadata, 'r:gz') as sdist:
         sdist_pkg_info = sdist.extractfile('full_metadata-1.2.3/PKG-INFO').read().decode()
 
-    assert sdist_pkg_info == textwrap.dedent('''\
+    metadata = re.escape(textwrap.dedent('''\
         Metadata-Version: 2.1
         Name: full-metadata
         Version: 1.2.3
@@ -65,7 +66,11 @@ def test_pep621(sdist_full_metadata):
         # full-metadata
 
         An example package with all of the PEP 621 metadata!
-    ''')
+    '''))
+
+    # pyproject-metadata 0.8.0 and later uses a comma to separate keywords
+    expr = metadata.replace(r'Keywords:\ full\ metadata', r'Keywords:\ full[ ,]metadata')
+    assert re.fullmatch(expr, sdist_pkg_info)
 
 
 def test_dynamic_version(sdist_dynamic_version):