From c2608c5befb7c5c9d10b4b73944e5b9404dc5612 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 11 Sep 2023 11:05:35 +0100 Subject: [PATCH 1/3] Update test dependency on build --- setup.cfg | 2 +- tox.ini | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 38a853ecdb..f01c0122bd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -87,7 +87,7 @@ testing-integration = wheel jaraco.path>=3.2.0 jaraco.envs>=2.2 - build[virtualenv] + build[virtualenv]>=1.0.3 filelock>=3.4.0 packaging diff --git a/tox.ini b/tox.ini index 783827d26e..166f3e3909 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,6 @@ [testenv] deps = # Ideally all the dependencies should be set as "extras" - build[virtualenv] @ git+https://github.com/pypa/build@59c1f87 - # ^-- pypa/build#630, use dev version while we wait for the new release packaging @ git+https://github.com/pypa/packaging@7e68d82 # ^-- use dev version while we wait for the new release setenv = From dca98f8b6f04bcf73db8f7c1d3eb2ecdb8ceebc9 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 11 Sep 2023 11:19:58 +0100 Subject: [PATCH 2/3] Add fallback for old packaging --- setup.cfg | 2 +- setuptools/tests/_packaging_compat.py | 9 +++++++++ setuptools/tests/config/test_apply_pyprojecttoml.py | 4 +++- setuptools/tests/test_core_metadata.py | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 setuptools/tests/_packaging_compat.py diff --git a/setup.cfg b/setup.cfg index f01c0122bd..5e86f65960 100644 --- a/setup.cfg +++ b/setup.cfg @@ -89,7 +89,7 @@ testing-integration = jaraco.envs>=2.2 build[virtualenv]>=1.0.3 filelock>=3.4.0 - packaging + packaging>=23.1 # TODO: update once packaging 23.2 is available docs = # upstream diff --git a/setuptools/tests/_packaging_compat.py b/setuptools/tests/_packaging_compat.py new file mode 100644 index 0000000000..5bdcc554d5 --- /dev/null +++ b/setuptools/tests/_packaging_compat.py @@ -0,0 +1,9 @@ +from packaging import __version__ as packaging_version + +if tuple(packaging_version.split(".")) >= ("23", "2"): + from packaging.metadata import Metadata +else: + # Just pretend it exists while waiting for release... + from unittest.mock import MagicMock + + Metadata = MagicMock() diff --git a/setuptools/tests/config/test_apply_pyprojecttoml.py b/setuptools/tests/config/test_apply_pyprojecttoml.py index ffcbd318a2..c0c6b13392 100644 --- a/setuptools/tests/config/test_apply_pyprojecttoml.py +++ b/setuptools/tests/config/test_apply_pyprojecttoml.py @@ -13,7 +13,9 @@ import pytest from ini2toml.api import Translator -from packaging.metadata import Metadata + +# TODO: replace with `from packaging.metadata import Metadata` in future versions +from .._packaging_compat import Metadata import setuptools # noqa ensure monkey patch to metadata from setuptools.dist import Distribution diff --git a/setuptools/tests/test_core_metadata.py b/setuptools/tests/test_core_metadata.py index 8c2483f26e..92717bd8bf 100644 --- a/setuptools/tests/test_core_metadata.py +++ b/setuptools/tests/test_core_metadata.py @@ -5,7 +5,8 @@ import pytest -from packaging.metadata import Metadata +# TODO: replace with `from packaging.metadata import Metadata` in future versions: +from ._packaging_compat import Metadata from setuptools import sic, _reqs from setuptools.dist import Distribution From 6981c042e63fc117cfb5a9add28dab3f15dfc79b Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 11 Sep 2023 11:29:18 +0100 Subject: [PATCH 3/3] Add news fragment --- newsfragments/4045.misc.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 newsfragments/4045.misc.rst diff --git a/newsfragments/4045.misc.rst b/newsfragments/4045.misc.rst new file mode 100644 index 0000000000..ce3de929ae --- /dev/null +++ b/newsfragments/4045.misc.rst @@ -0,0 +1,2 @@ +Update test dependency on ``build==1.0.3`` and +add fallback for ``packaging==23.1`` (regarding ``Metadata`` validation).