-
Notifications
You must be signed in to change notification settings - Fork 159
Async fixtures, explicit user-defined loops and more #24
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
Conversation
+1 |
@Tinche sorry for disrupting, but is this project maintained? |
Hi, yes it is, we had a new release 10 days ago. This is hard for me to review because there is a bunch of changes and no rationale for any of them. For one, I think an important goal of this library is that ordinary, non-complex usage should be the default, and complex features should be available if you want them. So, I like the current approach of having a special fixture named As for changing the scope of the event loop used, I think the existing mechanism of overriding the event_loop fixture should be good for that, but it needs to be refactored a little. Currently the Async fixtures look interesting, those would be valuable to support. If you want to contribute, a good first step would be to fix the default |
@Tinche rationale is in the readme, it's literally a bunch of features allowing more flexibility.
Unfortunately, this leads to very weird errors for a library developer who decided to use a custom user-provided event loop instead of always getting the global one due to programming errors when the loop wasn't explicitly passed to The rest is okay to me. |
Well, you can write simple to moderate asyncio applications using just a single loop in the main thread, and asyncio itself supports it with the asyncio.get_event_loop function. So people relatively new to asyncio are likely to just write code that makes asyncio use the global loop, and those are the people that we should support out of the box. Now, we can talk about ways to document this and make it easier to test without a global loop. For example, we could have a command line parameter that changes the default from False to True. Then you could just add this setting to your pytest.ini. |
Great work @malinoff! |
I'm with @malinoff |
Any chance to get this merged and released? |
Would love to see the async fixtures to be added to this project. |
Hi, I've recently merged in support for function-scoped async fixtures, but haven't yet made a release. (#45) Please try it out directly from git if you have the time and willpower, and report any bugs. (Closing this PR.) |
Hi, this PR is not supposed to be merged. Instead, I want to discuss these changes, fix what is wrong, add backwards compatibility layer if needed, and then if everybody is okay I want to create separate PRs with small changes.
Please, refer to the readme to see the major changes.