nvbn / thefuck

Magnificent app which corrects your previous console command.
MIT License
83.62k stars 3.41k forks source link

Compatibility with pytest 8 #1438

Open frenzymadness opened 2 months ago

frenzymadness commented 2 months ago

I'm not yet sure why but when I run tests with pytest 8, 4 of them fail:

========================================= FAILURES ==========================================
_ TestGetValidHistoryWithoutCurrent.test_get_valid_history_without_current[le cat-result0] __

self = <tests.test_utils.TestGetValidHistoryWithoutCurrent object at 0x7fa5c8fc9e20>
script = 'le cat', result = ['ls cat', 'diff x', 'café ô']

    @pytest.mark.parametrize('script, result', [
        ('le cat', ['ls cat', 'diff x', u'café ô']),
        ('diff x', ['ls cat', u'café ô']),
        ('fuck', ['ls cat', 'diff x', u'café ô']),
        (u'cafe ô', ['ls cat', 'diff x', u'café ô']),
    ])
    def test_get_valid_history_without_current(self, script, result):
        command = Command(script, '')
>       assert get_valid_history_without_current(command) == result
E       AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô']
E         
E         Right contains one more item: 'café ô'
E         
E         Full diff:
E           [
E               'ls cat',
E               'diff x',
E         -     'café ô',
E           ]

/home/lbalhar/Software/thefuck/tests/test_utils.py:276: AssertionError
_ TestGetValidHistoryWithoutCurrent.test_get_valid_history_without_current[diff x-result1] __

self = <tests.test_utils.TestGetValidHistoryWithoutCurrent object at 0x7fa5c8fca030>
script = 'diff x', result = ['ls cat', 'café ô']

    @pytest.mark.parametrize('script, result', [
        ('le cat', ['ls cat', 'diff x', u'café ô']),
        ('diff x', ['ls cat', u'café ô']),
        ('fuck', ['ls cat', 'diff x', u'café ô']),
        (u'cafe ô', ['ls cat', 'diff x', u'café ô']),
    ])
    def test_get_valid_history_without_current(self, script, result):
        command = Command(script, '')
>       assert get_valid_history_without_current(command) == result
E       AssertionError: assert ['ls cat'] == ['ls cat', 'café ô']
E         
E         Right contains one more item: 'café ô'
E         
E         Full diff:
E           [
E               'ls cat',
E         -     'café ô',
E           ]

/home/lbalhar/Software/thefuck/tests/test_utils.py:276: AssertionError
__ TestGetValidHistoryWithoutCurrent.test_get_valid_history_without_current[fuck-result2] ___

self = <tests.test_utils.TestGetValidHistoryWithoutCurrent object at 0x7fa5c8fca0f0>
script = 'fuck', result = ['ls cat', 'diff x', 'café ô']

    @pytest.mark.parametrize('script, result', [
        ('le cat', ['ls cat', 'diff x', u'café ô']),
        ('diff x', ['ls cat', u'café ô']),
        ('fuck', ['ls cat', 'diff x', u'café ô']),
        (u'cafe ô', ['ls cat', 'diff x', u'café ô']),
    ])
    def test_get_valid_history_without_current(self, script, result):
        command = Command(script, '')
>       assert get_valid_history_without_current(command) == result
E       AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô']
E         
E         Right contains one more item: 'café ô'
E         
E         Full diff:
E           [
E               'ls cat',
E               'diff x',
E         -     'café ô',
E           ]

/home/lbalhar/Software/thefuck/tests/test_utils.py:276: AssertionError
_ TestGetValidHistoryWithoutCurrent.test_get_valid_history_without_current[cafe \xf4-result3] _

self = <tests.test_utils.TestGetValidHistoryWithoutCurrent object at 0x7fa5c9070110>
script = 'cafe ô', result = ['ls cat', 'diff x', 'café ô']

    @pytest.mark.parametrize('script, result', [
        ('le cat', ['ls cat', 'diff x', u'café ô']),
        ('diff x', ['ls cat', u'café ô']),
        ('fuck', ['ls cat', 'diff x', u'café ô']),
        (u'cafe ô', ['ls cat', 'diff x', u'café ô']),
    ])
    def test_get_valid_history_without_current(self, script, result):
        command = Command(script, '')
>       assert get_valid_history_without_current(command) == result
E       AssertionError: assert ['ls cat', 'diff x'] == ['ls cat', 'diff x', 'café ô']
E         
E         Right contains one more item: 'café ô'
E         
E         Full diff:
E           [
E               'ls cat',
E               'diff x',
E         -     'café ô',
E           ]

/home/lbalhar/Software/thefuck/tests/test_utils.py:276: AssertionError

There are some known breaking changes in pytest 8 but I'm not sure which one causes this at the moment.