Bug 2251908 - python-pytest-mock fails to build with Python 3.13: indentation mismatch leading to 5 test failures
Summary: python-pytest-mock fails to build with Python 3.13: indentation mismatch lead...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pytest-mock
Version: 40
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Julien Enselme
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-11-28 11:51 UTC by Karolina Surma
Modified: 2024-06-19 00:26 UTC (History)
5 users (show)

Fixed In Version: python-pytest-mock-3.12.0-5.fc41
Clone Of:
Environment:
Last Closed: 2024-06-19 00:26:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2023-11-28 11:51:47 UTC
python-pytest-mock fails to build with Python 3.13.0a2.

This report is automated and not very verbose, but we'll try to get back here with details.

___ TestMockerStub.test_failure_message_with_name[The Castle of aaarrrrggh] ____

self = <test_pytest_mock.TestMockerStub object at 0x7f6b903bf470>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f6b9043fc50>
name = 'The Castle of aaarrrrggh'

    @pytest.mark.parametrize("name", (None, "", "f", "The Castle of aaarrrrggh"))
    def test_failure_message_with_name(self, mocker: MagicMock, name: str) -> None:
>       self.__test_failure_message(mocker, name=name)

tests/test_pytest_mock.py:258: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_pytest_mock.TestMockerStub object at 0x7f6b903bf470>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f6b9043fc50>
kwargs = {'name': 'The Castle of aaarrrrggh'}
expected_name = 'The Castle of aaarrrrggh'
msg = 'expected call not found.\nExpected: {0}()\nActual: not called.'
expected_message = 'expected call not found.\nExpected: The Castle of aaarrrrggh()\nActual: not called.'
stub = <MagicMock name='The Castle of aaarrrrggh' spec='function' id='140099958603408'>
exc_info = <ExceptionInfo AssertionError('expected call not found.\nExpected: The Castle of aaarrrrggh()\n  Actual: not called.') tblen=3>
@py_assert2 = AssertionError('expected call not found.\nExpected: The Castle of aaarrrrggh()\n  Actual: not called.')
@py_assert4 = 'expected call not found.\nExpected: The Castle of aaarrrrggh()\n  Actual: not called.'

    def __test_failure_message(self, mocker: MockerFixture, **kwargs: Any) -> None:
        expected_name = kwargs.get("name") or "mock"
        if 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:
            stub.assert_called_with()
>       assert str(exc_info.value) == expected_message
E       AssertionError: assert 'expected cal...: not called.' == 'expected cal...: not called.'
E           expected call not found.
E           Expected: The Castle of aaarrrrggh()
E         - Actual: not called.
E         +   Actual: not called.
E         ? ++

tests/test_pytest_mock.py:251: AssertionError
=========================== short test summary info ============================
FAILED tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_no_name
FAILED tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[None]
FAILED tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[]
FAILED tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[f]
FAILED tests/test_pytest_mock.py::TestMockerStub::test_failure_message_with_name[The Castle of aaarrrrggh]
================= 5 failed, 67 passed, 10 deselected in 1.58s ==================

https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06692245-python-pytest-mock/

For all our attempts to build python-pytest-mock with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-pytest-mock/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Julien Enselme 2024-02-08 19:34:22 UTC
Fixed in https://bodhi.fedoraproject.org/updates/FEDORA-2024-3dbbd05c75 And latest builds succeed in copr too!

Comment 2 Aoife Moloney 2024-02-15 23:06:00 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.


Note You need to log in before you can comment on or make changes to this bug.