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

TrioDeprecationWarning: trio.MultiError is deprecated since Trio 0.22.0 #128

Closed
richardsheridan opened this issue Oct 9, 2022 · 2 comments · Fixed by #130
Closed

TrioDeprecationWarning: trio.MultiError is deprecated since Trio 0.22.0 #128

richardsheridan opened this issue Oct 9, 2022 · 2 comments · Fixed by #130

Comments

@richardsheridan
Copy link

For a trivial environment and failing test, warnings are generated due to the direct usage of multierror:
pip install pytest-trio
echo "from pytest_trio.enable_trio_mode import *" > conftest.py
echo "async def test_warning(): assert False" > test_warning.py

Output

(tmp) C:\Users\richa\Documents\GitHub\tmp>pytest test_warning.py
============================= test session starts =============================
platform win32 -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: C:\Users\richa\Documents\GitHub\tmp
plugins: trio-0.7.0
collected 1 item

test_warning.py F                                                        [100%]

================================== FAILURES =================================== 
________________________________ test_warning _________________________________ 

value = <trio.Nursery object at 0x000001A125D6B550>

    async def yield_(value=None):
>       return await _yield_(value)

..\..\..\miniconda3\envs\tmp\lib\site-packages\async_generator\_impl.py:106:    
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
..\..\..\miniconda3\envs\tmp\lib\site-packages\async_generator\_impl.py:99: in _yield_
    return (yield _wrap(value))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    async def test_warning():
>       assert False
E       assert False

test_warning.py:3: AssertionError
============================== warnings summary =============================== 
test_warning.py::test_warning
  C:\Users\richa\miniconda3\envs\tmp\lib\site-packages\pytest_trio\plugin.py:409
: TrioDeprecationWarning: trio.MultiError is deprecated since Trio 0.22.0; use B
aseExceptionGroup (on Python 3.11 and later) or exceptiongroup.BaseExceptionGroup 
(earlier versions) instead (https://github.com/python-trio/trio/issues/2211)  
    raise trio.MultiError(test_ctx.error_list)

test_warning.py::test_warning
  C:\Users\richa\miniconda3\envs\tmp\lib\site-packages\pytest_trio\plugin.py:62:
 TrioDeprecationWarning: trio.MultiError is deprecated since Trio 0.22.0; use Ba
seExceptionGroup (on Python 3.11 and later) or exceptiongroup.BaseExceptionGroup 
(earlier versions) instead (https://github.com/python-trio/trio/issues/2211)   
    if issubclass(call.excinfo.type, trio.MultiError):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info =========================== 
FAILED test_warning.py::test_warning - assert False
======================== 1 failed, 2 warnings in 0.13s ======================== 

@pquentin
Copy link
Member

pquentin commented Oct 9, 2022

Probably easier said than done, but I think pytest-trio should migrate to ExceptionGroup and release a new version that requires Trio 0.22.

@pquentin
Copy link
Member

pquentin commented Nov 1, 2022

I released pytest-trio 0.8.0 with ExceptionGroup support. Thank you @Zac-HD!

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 a pull request may close this issue.

2 participants