Patch-Source: https://github.com/mesonbuild/meson-python/commit/225a26d8c854987897448b17478166570c7be777.patch
--
From 225a26d8c854987897448b17478166570c7be777 Mon Sep 17 00:00:00 2001
From: Daniele Nicolodi <daniele@grinta.net>
Date: Mon, 15 Apr 2024 22:34:36 +0200
Subject: [PATCH] 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):
