python-trio / trio-asyncio

a re-implementation of the asyncio mainloop on top of Trio
Other
187 stars 37 forks source link

TestMisc.test_run_task fails on python 3.11 #120

Closed mweinelt closed 8 months ago

mweinelt commented 1 year ago

Hi, we're seeing the following test fail on 0.12.0 with python 3.11.3. Is this project still maintained and will it be updated for python 3.11?

____________________________ TestMisc.test_run_task ____________________________

value = <trio.Nursery object at 0xfffff57e5fd0>

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

/nix/store/d6nw29xn6ca13k5d8hd85r0flch568yp-python3.11-async-generator-1.10/lib/python3.11/site-packages/async_generator/_impl.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/d6nw29xn6ca13k5d8hd85r0flch568yp-python3.11-async-generator-1.10/lib/python3.11/site-packages/async_generator/_impl.py:99: in _yield_
    return (yield _wrap(value))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_misc.TestMisc object at 0xfffff56cf790>

    @pytest.mark.trio
    async def test_run_task(self):
        owch = 0

        async def nest(x):
            nonlocal owch
            owch += x

        with pytest.raises(RuntimeError):
            trio_asyncio.run_trio_task(nest, 100)

        with pytest.raises((AttributeError, RuntimeError)):
>           with trio_asyncio.open_loop():
E           TypeError: '_AsyncGeneratorContextManager' object does not support the context manager protocol

tests/test_misc.py:105: TypeError
oremanj commented 1 year ago

That test failure is because using a synchronous with statement on an async context manager changed from raising AttributeError to raising TypeError. It's not material to the functioning of the library.

trio-asyncio is not particularly maintained but as far as I know it still works fine in practice on recent Pythons.