-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add custom hooks specifications for overriding setup_timeout and teardown_timeout methods #117
Conversation
Why not, I think this roughly looks good. I have two questions:
|
Long story short: I suggest change nothing except documenting added functionality in README (plus the PR itself, sure). The long story begins. I'm happy that you want to accept the plugin functionality extending. Regarding The public API question is harder. The next step is more interesting. I really don't think that we can restrict available names to public API I believe, new hook definitions should be described by REAME, that's it. Regarding exposing
seems to my eye less natural than
Please feel free to ask me if the text is not clear. Maybe I've missed some important thing. Thank you for the long reading :) |
Thanks for checking out the On how to get hold of the plugin, I think there's a semantic difference between importing it and using the plugin manager to get a reference. Importing you simply get the module which happens to provide the plugin. Using the plugin manager you get the object instance which is being used by pytest. So my understanding was that you wanted So how about still doing this before merging:
|
@flub |
Co-authored-by: Floris Bruynooghe <[email protected]>
Co-authored-by: Floris Bruynooghe <[email protected]>
thanks for the nice quality PR and followup! |
Welcome and thanks for kind review! |
Do you have an estimation for new release? |
On Sun 16 Jan 2022 at 10:59 -0800, Andrew Svetlov wrote:
Do you have an estimation for new release?
done. there was some trouble with the readme (TIL about readme_renderer
and `twine check`) so I originally pushed bad tags but hopefully
everything is fine now, let me know if not.
|
Awesome, thanks! |
Using bare
pytest-timeout
withpytest-asyncio
works but timeout's traceback is not perfect.It points at
selector.select()
call (epoll.poll()
for linux case for example) instead of timed outawait f(...)
call.pytest-asyncio
has a pull request for providing better timeout support pytest-dev/pytest-asyncio#216 which generates awesome tracebacks but doesn't work well with a debugger.I don't want to copy-paste all hard work that is done by
pytest-timeout
already but propose two hooks instead:pytest_timeout_setup(item)
andpytest_timeout_teardown(item)
, both are marked astryfirst=True
.Having these hooks,
pytest-asyncio
can provide its own implementation (which should usepluginmanager.get_plugin('timeout').is_debugging()
, sure) to override default timeout methods but keep all other functionality untouched.The pull request deliberately adds the minimum required changes only.
In the future, I can imagine a pluggable
timeout_method
choice set but it is not required for the bare minimum.