From 59500dd5ba08fd4dbefe43f0300336f5c69e37fb Mon Sep 17 00:00:00 2001 From: Carl Smedstad Date: Sat, 28 Sep 2024 18:05:12 +0200 Subject: [PATCH] Make tests compatibly with pytest v8.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test test_get_valid_history_without_current fails when using pytest v8.x in the following manner: AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô'] AssertionError: assert ['ls cat'] == ['ls cat', 'café ô'] AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô'] AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô'] The issue stems from the function thefuck/utils.py:get_all_executables() and seems to be related to the memoization decorator used. Disable memoization the failing tests with the fixture 'no_meomize' to resolve the issue. --- tests/test_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index 95f92bcba..ac2a36289 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -265,6 +265,7 @@ def bins(self, mocker): path_mock = mocker.Mock(iterdir=mocker.Mock(return_value=callables)) return mocker.patch('thefuck.utils.Path', return_value=path_mock) + @pytest.mark.usefixtures('no_memoize') @pytest.mark.parametrize('script, result', [ ('le cat', ['ls cat', 'diff x', u'café ô']), ('diff x', ['ls cat', u'café ô']),