summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-02-03 16:00:07 +0100
committerMichał Górny <mgorny@gentoo.org>2024-02-03 16:01:46 +0100
commitd5be907debc59e876779de7a8915a687a5899cf0 (patch)
tree619be5795bcb929747696c0515d65218f18184f0 /dev-python/pytest-mock
parentdev-python/pypy3_9-exe-bin: Remove old (diff)
downloadgentoo-d5be907debc59e876779de7a8915a687a5899cf0.tar.gz
gentoo-d5be907debc59e876779de7a8915a687a5899cf0.tar.bz2
gentoo-d5be907debc59e876779de7a8915a687a5899cf0.zip
dev-python/pytest-mock: Backport a test fix
Closes: https://bugs.gentoo.org/923140 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/pytest-mock')
-rw-r--r--dev-python/pytest-mock/files/pytest-mock-3.12.0-test.patch34
-rw-r--r--dev-python/pytest-mock/pytest-mock-3.12.0.ebuild7
2 files changed, 40 insertions, 1 deletions
diff --git a/dev-python/pytest-mock/files/pytest-mock-3.12.0-test.patch b/dev-python/pytest-mock/files/pytest-mock-3.12.0-test.patch
new file mode 100644
index 000000000000..e3938fb1457c
--- /dev/null
+++ b/dev-python/pytest-mock/files/pytest-mock-3.12.0-test.patch
@@ -0,0 +1,34 @@
+From 39547ecdc051123750dd17a890c0492ac5d5b1a0 Mon Sep 17 00:00:00 2001
+From: Daniel Garcia Moreno <daniel.garcia@suse.com>
+Date: Wed, 20 Dec 2023 13:39:14 +0100
+Subject: [PATCH] Update expected message to match python 3.11.7
+
+https://github.com/python/cpython/issues/111019
+---
+ tests/test_pytest_mock.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py
+index c185f2a..01534a4 100644
+--- a/tests/test_pytest_mock.py
++++ b/tests/test_pytest_mock.py
+@@ -25,6 +25,8 @@
+
+ # Python 3.8 changed the output formatting (bpo-35500), which has been ported to mock 3.0
+ NEW_FORMATTING = sys.version_info >= (3, 8)
++# Python 3.11.7 changed the output formatting, https://github.com/python/cpython/issues/111019
++NEWEST_FORMATTING = sys.version_info >= (3, 11, 7)
+
+ if sys.version_info[:2] >= (3, 8):
+ from unittest.mock import AsyncMock
+@@ -240,7 +242,9 @@ def test_repr_with_name(self, mocker: MockerFixture) -> None:
+
+ def __test_failure_message(self, mocker: MockerFixture, **kwargs: Any) -> None:
+ expected_name = kwargs.get("name") or "mock"
+- if NEW_FORMATTING:
++ if NEWEST_FORMATTING:
++ msg = "expected call not found.\nExpected: {0}()\n Actual: not called."
++ elif NEW_FORMATTING:
+ msg = "expected call not found.\nExpected: {0}()\nActual: not called."
+ else:
+ msg = "Expected call: {0}()\nNot called"
diff --git a/dev-python/pytest-mock/pytest-mock-3.12.0.ebuild b/dev-python/pytest-mock/pytest-mock-3.12.0.ebuild
index 21e83bfc0670..ccb417b563d1 100644
--- a/dev-python/pytest-mock/pytest-mock-3.12.0.ebuild
+++ b/dev-python/pytest-mock/pytest-mock-3.12.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -34,6 +34,11 @@ BDEPEND="
distutils_enable_tests pytest
+PATCHES=(
+ # https://github.com/pytest-dev/pytest-mock/pull/404
+ "${FILESDIR}/${P}-test.patch"
+)
+
python_test() {
if ! has "${EPYTHON/./_}" "${PYTHON_TESTED[@]}"; then
einfo "Skipping tests on ${EPYTHON}"