Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:plasmaregataos
python-pytest-mock
fix-tests-python3117.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-tests-python3117.patch of Package python-pytest-mock
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)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor