commit: f5f8d972823e6dbbc3062e8f9a744035951d7b87 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sun Nov 19 08:08:29 2023 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sun Nov 19 08:08:29 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5f8d972
dev-python/tavern: Enable py3.12 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> dev-python/tavern/files/tavern-2.6.0-py312.patch | 38 ++++++++++++++++++++++++ dev-python/tavern/tavern-2.6.0.ebuild | 7 ++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/dev-python/tavern/files/tavern-2.6.0-py312.patch b/dev-python/tavern/files/tavern-2.6.0-py312.patch new file mode 100644 index 000000000000..679b0c9d2358 --- /dev/null +++ b/dev-python/tavern/files/tavern-2.6.0-py312.patch @@ -0,0 +1,38 @@ +From 8c09a6f31d84904dcf411e50102ac1ad159e4dd9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]> +Date: Sun, 19 Nov 2023 08:56:20 +0100 +Subject: [PATCH] Fix assertion in TestCheckParseValues::test_warns_bad_type + +Fix the assertion in TestCheckParseValues::test_warns_bad_type +to use `.assert_called_with()` rather than non-existing `.called_with()` +method. The latter is wrongly interpreted as calling a mocked method +in Python < 3.12, and therefore does not test anything at all. Starting +with Python 3.12, it results in an error: + + AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute. + +Fixing the call also revealed that the assertion was incorrect, so I've +updated it to match the current call. +--- + tests/unit/test_helpers.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/unit/test_helpers.py b/tests/unit/test_helpers.py +index 0d3da1c4..19fddc08 100644 +--- a/tests/unit/test_helpers.py ++++ b/tests/unit/test_helpers.py +@@ -300,10 +300,10 @@ def test_warns_bad_type(self, item): + with patch("tavern._core.dict_util.logger.warning") as wmock: + _check_and_format_values("{fd}", {"fd": item}) + +- assert wmock.called_with( +- "Formatting 'fd' will result in it being coerced to a string (it is a {})".format( +- type(item) +- ) ++ wmock.assert_called_with( ++ "Formatting '%s' will result in it being coerced to a string (it is a %s)", ++ "fd", ++ type(item), + ) + + @pytest.mark.parametrize("item", [1, "a", 1.3, format_keys("{s}", {"s": 2})]) diff --git a/dev-python/tavern/tavern-2.6.0.ebuild b/dev-python/tavern/tavern-2.6.0.ebuild index a8c32af99f98..0f7c20bb2375 100644 --- a/dev-python/tavern/tavern-2.6.0.ebuild +++ b/dev-python/tavern/tavern-2.6.0.ebuild @@ -4,7 +4,7 @@ EAPI=8 DISTUTILS_USE_PEP517=flit -PYTHON_COMPAT=( python3_{10..11} ) +PYTHON_COMPAT=( python3_{10..12} ) inherit distutils-r1 @@ -44,11 +44,16 @@ BDEPEND=" distutils_enable_tests pytest src_prepare() { + local PATCHES=( + "${FILESDIR}/${P}-py312.patch" + ) + # strip unnecessary pins, upstream doesn't update them a lot sed -i -E -e 's:,?<=?[0-9.]+::' pyproject.toml || die distutils-r1_src_prepare } python_test() { + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 epytest -p tavern }
