Sync from SUSE:ALP:Source:Standard:1.0 python-pytest-mock revision 64dc95f3b8a73f3ed84f7c566dcfbf3d

This commit is contained in:
Adrian Schröter 2024-03-05 18:21:41 +01:00
parent 249b4b7797
commit 06a0c2e6fe
5 changed files with 67 additions and 5 deletions

View File

@ -0,0 +1,44 @@
From 8480bb6d0500f933be039cfec65e04157e6ecffe Mon Sep 17 00:00:00 2001
From: Bruno Oliveira <nicoddemus@gmail.com>
Date: Tue, 19 Dec 2023 08:24:23 -0300
Subject: [PATCH 1/2] Fix tests for Python 3.11 and 3.12
Fixes #401.
---
tests/test_pytest_mock.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: pytest-mock-3.12.0/tests/test_pytest_mock.py
===================================================================
--- pytest-mock-3.12.0.orig/tests/test_pytest_mock.py
+++ pytest-mock-3.12.0/tests/test_pytest_mock.py
@@ -25,6 +25,7 @@ skip_pypy = pytest.mark.skipif(
# Python 3.8 changed the output formatting (bpo-35500), which has been ported to mock 3.0
NEW_FORMATTING = sys.version_info >= (3, 8)
+NEWEST_FORMATTING = sys.version_info >= (3, 11, 7)
if sys.version_info[:2] >= (3, 8):
from unittest.mock import AsyncMock
@@ -240,15 +241,18 @@ class TestMockerStub:
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"
expected_message = msg.format(expected_name)
stub = mocker.stub(**kwargs)
- with pytest.raises(AssertionError) as exc_info:
+ with pytest.raises(
+ AssertionError, match=re.escape(expected_message)
+ ) as exc_info:
stub.assert_called_with()
- assert str(exc_info.value) == expected_message
def test_failure_message_with_no_name(self, mocker: MagicMock) -> None:
self.__test_failure_message(mocker)

BIN
pytest-mock-3.11.1.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
pytest-mock-3.12.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Wed Dec 20 12:28:16 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Fix tests with python 3.11.7
- Add patch fix-tests-python3117.patch gh#pytest-dev/pytest-mock#403
-------------------------------------------------------------------
Tue Nov 7 19:35:58 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 3.12.0:
* Added support for Python 3.12.
* Dropped support for EOL Python 3.7.
* ``mocker.resetall()`` now also resets mocks created by
``mocker.create_autospec`` (`#390`_).
-------------------------------------------------------------------
Mon Jul 24 19:10:29 UTC 2023 - Dirk Müller <dmueller@suse.com>
@ -186,7 +201,7 @@ Fri Jul 26 12:26:36 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
-------------------------------------------------------------------
Thu Jul 18 08:52:38 UTC 2019 - Ondřej Súkup <mimi.vx@gmail.com>
- add upstream patch to test with pytest5 - fix_tests.patch
- add upstream patch to test with pytest5 - fix_tests.patch
-------------------------------------------------------------------
Wed May 15 17:39:00 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -18,12 +18,15 @@
%{?sle15_python_module_pythons}
Name: python-pytest-mock
Version: 3.11.1
Version: 3.12.0
Release: 0
Summary: Thin-wrapper around the mock package for easier use with pytest
License: MIT
URL: https://github.com/pytest-dev/pytest-mock
Source: https://files.pythonhosted.org/packages/source/p/pytest-mock/pytest-mock-%{version}.tar.gz
# PATCH-FIX-UPSTREAM: fix-tests-python3117.patch gh#pytest-dev/pytest-mock#403
Patch0: fix-tests-python3117.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module pytest >= 5}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module py}