TvoroG / pytest-lazy-fixture

It helps to use fixtures in pytest.mark.parametrize
MIT License
379 stars 30 forks source link

0.5.2 problem with pytest-asyncio #38

Closed youknowone closed 5 years ago

youknowone commented 5 years ago

I made a PR to upgrade pytest-lazy-fixture 0.4.2 to 0.5.2.

It worked with 0.4.2 but doesn't work with 0.5.2 anymore. Any idea?

The errors are refering about event loop

E       RuntimeError: Task <Task pending coro=<test_complicated_key() running at /Users/youknowone/Projects/ring/tests/_test_func_asyncio.py:183> cb=[_run_until_complete_cb() at ~/.pyenv/versions/3.7.0/lib/python3.7/asyncio/base_events.py:150]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_connect_done(22)()]> attached to a different loop

Because upgrading pytest-lazy-fixture triggers the problem regardless of pytest-asyncio version, I guessed this may be a regression in pytest-lazy-fixture. Please let me know if the change in pytest-lazy-fixture is not a problem. Then I should change my code to fit in new version.

YannickJadoul commented 5 years ago

To be fair, I don't even see where lazy-fixture is being used, in the output of the failed tasks. Could you tell us where to look?

(For future reference, these are the changes between v0.4.2 and v0.5.2: https://github.com/TvoroG/pytest-lazy-fixture/compare/v0.4.2...v0.5.2)

youknowone commented 5 years ago

I am sorry for the lack of informations.

The first failed task test_common is defined here: https://github.com/youknowone/ring/blob/master/tests/_test_func_asyncio.py#L102 Which uses storage_and_ring using the lazy fixture https://github.com/youknowone/ring/blob/master/tests/_test_func_asyncio.py#L45

But at this time, I tried to create a minimal reproduction and found weird thing.

By installing 0.4.2 -> No problem By installing 0.5.2 -> Breaking By uninstalling any version -> Breaking (in same way as 0.5.2)

So, it was not broken by 0.5.2 but unexpectedly fixed by 0.4.2. (Still no idea how it does even by reading the changes)

I am sorry for bothering by wrong issue.

YannickJadoul commented 5 years ago

Oh, right, no problem! That's very unexpected, though. Well, I'm curious now, though; let us know if you find out, please :-) If there's anything I can do or check, do let me know.

youknowone commented 5 years ago

I want to explain well but not really. I checked asyncio.get_event_loop result differs by the version of pytest-lazy-fixture. But it is the result, not the causes. I am sorry not to give a good answer.