Sync from SUSE:SLFO:Main python-pytest-mock revision 0a5f68aada970abfdd938e2317725cb2
This commit is contained in:
parent
5e7aa83d33
commit
64b1d9f49e
@ -1,44 +0,0 @@
|
|||||||
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.12.0.tar.gz
(Stored with Git LFS)
BIN
pytest-mock-3.12.0.tar.gz
(Stored with Git LFS)
Binary file not shown.
BIN
pytest-mock-3.14.0.tar.gz
(Stored with Git LFS)
Normal file
BIN
pytest-mock-3.14.0.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,26 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Sep 2 01:46:28 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Drop python-py requirement, no longer required.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 8 10:47:18 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- update to 3.14.0:
|
||||||
|
* #415: MockType and AsyncMockType can be imported from
|
||||||
|
pytest_mock for type annotation purposes.
|
||||||
|
* #420: Fixed a regression which would cause
|
||||||
|
mocker.patch.object to not being properly cleared between
|
||||||
|
tests.
|
||||||
|
* #417: spy now has spy_return_list, which is a list containing
|
||||||
|
all the values returned by the spied function.
|
||||||
|
* pytest-mock now requires pytest>=6.2.5.
|
||||||
|
* #410: pytest-mock's setup.py file is removed. If you relied
|
||||||
|
on this file, e.g. to install pytest using setup.py install,
|
||||||
|
please see Why you shouldn't invoke setup.py directly for
|
||||||
|
alternatives.
|
||||||
|
- drop fix-tests-python3117.patch (upstream)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Dec 20 12:28:16 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
Wed Dec 20 12:28:16 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pytest-mock
|
# spec file for package python-pytest-mock
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -18,23 +18,21 @@
|
|||||||
|
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-pytest-mock
|
Name: python-pytest-mock
|
||||||
Version: 3.12.0
|
Version: 3.14.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Thin-wrapper around the mock package for easier use with pytest
|
Summary: Thin-wrapper around the mock package for easier use with pytest
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/pytest-dev/pytest-mock
|
URL: https://github.com/pytest-dev/pytest-mock
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-mock/pytest-mock-%{version}.tar.gz
|
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 base >= 3.8}
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module pytest >= 5}
|
BuildRequires: %{python_module pytest >= 5}
|
||||||
BuildRequires: %{python_module pytest-asyncio}
|
BuildRequires: %{python_module pytest-asyncio}
|
||||||
BuildRequires: %{python_module py}
|
|
||||||
BuildRequires: %{python_module setuptools >= 36}
|
BuildRequires: %{python_module setuptools >= 36}
|
||||||
BuildRequires: %{python_module setuptools_scm}
|
BuildRequires: %{python_module setuptools_scm}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-py
|
|
||||||
Requires: python-pytest
|
Requires: python-pytest
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
@ -48,10 +46,10 @@ patches at the end of a test
|
|||||||
%autosetup -p1 -n pytest-mock-%{version}
|
%autosetup -p1 -n pytest-mock-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
@ -61,6 +59,6 @@ patches at the end of a test
|
|||||||
%doc CHANGELOG.rst
|
%doc CHANGELOG.rst
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%{python_sitelib}/pytest_mock
|
%{python_sitelib}/pytest_mock
|
||||||
%{python_sitelib}/pytest_mock-%{version}*-info
|
%{python_sitelib}/pytest_mock-%{version}.dist-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user