erdewit/nest_asyncio

Version 1.5.0 broke my pytest

BobCashStory opened this issue · 4 comments

since 2 hours my test stoped to pass


================================================= FAILURES =================================================
________________________________________________ test_init _________________________________________________

pyfuncitem = <Function test_init>

    @pytest.mark.tryfirst
    def pytest_pyfunc_call(pyfuncitem):
        funcargs = pyfuncitem.funcargs
        testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames}
    
        if not iscoroutinefunction(pyfuncitem.obj):
            pyfuncitem.obj(**testargs)
            return True
    
        try:
            loop = funcargs["io_loop"]
        except KeyError:
            loop = tornado.ioloop.IOLoop.current()
    
>       loop.run_sync(
            lambda: pyfuncitem.obj(**testargs), timeout=get_test_timeout(pyfuncitem)
        )

/usr/local/lib/python3.9/site-packages/pytest_tornasync/plugin.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/local/lib/python3.9/site-packages/tornado/ioloop.py:524: in run_sync
    self.start()
/usr/local/lib/python3.9/site-packages/tornado/platform/asyncio.py:199: in start
    self.asyncio_loop.run_forever()
/usr/local/lib/python3.9/site-packages/nest_asyncio.py:51: in run_forever
    with manage_run(self), manage_asyncgens(self):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <contextlib._GeneratorContextManager object at 0x111a22760>

    def __enter__(self):
        # do not keep args and kwds alive unnecessarily
        # they are only needed for recreation, which is not possible anymore
        del self.args, self.kwds, self.func
        try:
>           return next(self.gen)
E           TypeError: 'NoneType' object is not an iterator

/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py:117: TypeError
========================================= short test summary info ==========================================
FAILED tests/test_jobs.py::test_init - TypeError: 'NoneType' object is not an iterator
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================ 1 failed in 0.51s =============================================

You can see more in our CI if needed.
https://github.com/jupyter-naas/naas/runs/1777653142?check_suite_focus=true

Revert to 1.4.3 fix the issue you can check it there :

https://github.com/jupyter-naas/naas/runs/1777902486?check_suite_focus=true

Thanks for the report. It'll be fixed right away.

Should be fixed in v1.5.1

Thanks ! i pushed again with your change let's see !

I confirm that fixed