Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Avoid calling reset_mock() on a mock of super() to avoid Recur…
…sionError (#2528) Starting with Python 3.12.7 or 3.13.0rc3, the reset_mock() method calls super(). python/cpython#123934 This lead to: __________________________ test_python_remove_plotter __________________________ def test_python_remove_plotter(): """ Ensure the button states are returned to normal before calling super method. """ editor = mock.MagicMock() view = mock.MagicMock() with mock.patch("builtins.super") as mock_super: pm = PythonMode(editor, view) pm.set_buttons = mock.MagicMock() > mock_super.reset_mock() tests/modes/test_python3.py:489: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib64/python3.13/unittest/mock.py:2232: in reset_mock super().reset_mock(*args, return_value=return_value, **kwargs) /usr/lib64/python3.13/unittest/mock.py:2232: in reset_mock super().reset_mock(*args, return_value=return_value, **kwargs) /usr/lib64/python3.13/unittest/mock.py:2232: in reset_mock super().reset_mock(*args, return_value=return_value, **kwargs) E RecursionError: maximum recursion depth exceeded !!! Recursion detected (same locals & position) We avoid the problem by not needlessly calling reset_mock() in this test at all.
- Loading branch information