KenKundert / borg-space

Accessory for Emborg used to report and track the size of your Borg repositories
GNU General Public License v3.0
4 stars 1 forks source link

tests fails with pytest 8 #13

Open ncopa opened 7 months ago

ncopa commented 7 months ago

Tests are failing after pytest upgraded to 8.1.1 on Alpine linux edge x86_64:

======================================= test session starts ========================================
platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/ncopa/aports/community/borg-space/src/borg-space-2.2
configfile: pyproject.toml
plugins: cov-4.1.0, xdist-3.5.0, pytest_tmp_files-0.0.2, mock-3.10.0, requests-mock-1.11.0
32 workers [60 items]     
..........................F..........F......................                                 [100%]
============================================= FAILURES =============================================
__________________________________________ test_main[59] ___________________________________________
[gw26] linux -- Python 3.11.8 /home/ncopa/aports/community/borg-space/src/borg-space-2.2/.testenv/bin/python3

tmp_files = TestPath('/tmp/pytest-of-ncopa/pytest-69/popen-gw26/test_main_59_0'), name = 'misdo'
args = 'home', env = {}
stdout = 'bs error:\\s+❬HOME❭/.config/borg-space/settings.nt, repositories, home\\+!primary:\n    unknown key.'
stderr = '^$', status = 1

    @parametrize(
        schema = borg_space_schema,
        indirect = ['tmp_files'],
    )
    def test_main(tmp_files, name, args, env, stdout, stderr, status):
>       check_command(name, args, env, stdout, stderr, status, home=tmp_files)

tests/test_cli.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_cli.py:91: in check_command
    Matches(stdout, flags=re.DOTALL).assert_matches(borg_space.stdout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Matches('bs error:\\s+/tmp/pytest-of-ncopa/pytest-69/popen-gw26/test_main_59_0/.config/borg-space/settings.nt, reposit...ontains invalid characters: ‘!+’.
    #      ^
    #>            2 ❬    home+!primary: home❭
    #>                   ▲
s = 'bs error: /tmp/pytest-of-ncopa/pytest-69/popen-gw26/test_main_59_0/.config/borg-space/settings.nt, repositories, home+!primary:\n    key contains invalid characters: ‘!+’.\n           2 ❬    home+!primary: home❭\n                  ▲\n'

    def assert_matches(self, s: str) -> None:
>       assert self == s, self._fail
E       AssertionError:  regex failed to match at:
E       
E       > bs error: /tmp/pytest-of-ncopa/pytest-69/popen-gw26/test_main_59_0/.config/borg-space/settings.nt, repositories, home+!primary:
E       >     key contains invalid characters: ‘!+’.
E             ^
E       >            2 ❬    home+!primary: home❭
E       >                   ▲

/usr/lib/python3.11/site-packages/re_assert.py:63: AssertionError
--------------------------------------- Captured stdout call ---------------------------------------
Test name: misdo
__________________________________________ test_main[58] ___________________________________________
[gw25] linux -- Python 3.11.8 /home/ncopa/aports/community/borg-space/src/borg-space-2.2/.testenv/bin/python3

tmp_files = TestPath('/tmp/pytest-of-ncopa/pytest-69/popen-gw25/test_main_58_0'), name = 'prelude'
args = 'home', env = {}
stdout = 'bs error:\\s+❬HOME❭/.config/borg-space/settings.nt, repositories, home\\+primary:\n    unknown key.'
stderr = '^$', status = 1

    @parametrize(
        schema = borg_space_schema,
        indirect = ['tmp_files'],
    )
    def test_main(tmp_files, name, args, env, stdout, stderr, status):
>       check_command(name, args, env, stdout, stderr, status, home=tmp_files)

tests/test_cli.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_cli.py:91: in check_command
    Matches(stdout, flags=re.DOTALL).assert_matches(borg_space.stdout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Matches('bs error:\\s+/tmp/pytest-of-ncopa/pytest-69/popen-gw25/test_main_58_0/.config/borg-space/settings.nt, reposit...ontains an invalid character: ‘+’.
    #      ^
    #>            2 ❬    home+primary: home❭
    #>                   ▲
s = 'bs error: /tmp/pytest-of-ncopa/pytest-69/popen-gw25/test_main_58_0/.config/borg-space/settings.nt, repositories, home+primary:\n    key contains an invalid character: ‘+’.\n           2 ❬    home+primary: home❭\n                  ▲\n'

    def assert_matches(self, s: str) -> None:
>       assert self == s, self._fail
E       AssertionError:  regex failed to match at:
E       
E       > bs error: /tmp/pytest-of-ncopa/pytest-69/popen-gw25/test_main_58_0/.config/borg-space/settings.nt, repositories, home+primary:
E       >     key contains an invalid character: ‘+’.
E             ^
E       >            2 ❬    home+primary: home❭
E       >                   ▲

/usr/lib/python3.11/site-packages/re_assert.py:63: AssertionError
--------------------------------------- Captured stdout call ---------------------------------------
Test name: prelude
===================================== short test summary info ======================================
FAILED tests/test_cli.py::test_main[59] - AssertionError:  regex failed to match at:
FAILED tests/test_cli.py::test_main[58] - AssertionError:  regex failed to match at:
=================================== 2 failed, 58 passed in 3.87s ===================================
KenKundert commented 7 months ago

Oh, this is good news. It is not the update to pytest that caused the change, it is the update to voluptuous. That change is due to a pull request I made for voluptuous on behalf of this program. The change results in better error messages. I have updated the version requirement on voluptuous and updated the error messages. I have checked the fixes into github. Do you need me to release to pypi?

ncopa commented 7 months ago

New release would be handy but is not neccessary. I can backport the fix.

Thank you for fixing it so fast.