Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests compatible with pytest v8.x #1474

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carlsmedstad
Copy link

@carlsmedstad carlsmedstad commented Sep 28, 2024

Hey 👋 Arch Linux maintainer here.

The test test_get_valid_history_without_current fails when using pytest v8.x in the following manner:

======================================================== short test summary info =========================================================
FAILED tests/test_utils.py::TestGetValidHistoryWithoutCurrent::test_get_valid_history_without_current[le cat-result0] - AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô']
FAILED tests/test_utils.py::TestGetValidHistoryWithoutCurrent::test_get_valid_history_without_current[diff x-result1] - AssertionError: assert ['ls cat'] == ['ls cat', 'café ô']
FAILED tests/test_utils.py::TestGetValidHistoryWithoutCurrent::test_get_valid_history_without_current[fuck-result2] - AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô']
FAILED tests/test_utils.py::TestGetValidHistoryWithoutCurrent::test_get_valid_history_without_current[cafe \xf4-result3] - AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô']
======================================== 4 failed, 1793 passed, 62 skipped, 273 warnings in 4.04s ========================================

The issue stems from the function thefuck/utils.py:get_all_executables() and seems to be related to the memoization decorator used.

Disable memoization for the failing tests with the fixture no_meomize to resolve the issue.

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.
@carlsmedstad carlsmedstad changed the title Make tests compatibly with pytest v8.x Make tests compatible with pytest v8.x Sep 28, 2024
@principis
Copy link

Thanks! Shamelessly backporting for Fedora 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants