-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
pytest.skip option to allow to work at module level #2805
Comments
@nicoddemus Hi, can I try to fix this ? I'm not familiar with the codebase, but it looks like the following:
Is that correct ? |
Hi @georgeyk actually it is simpler. 😁
Lines 32 to 39 in 6690b8a
So it is just a matter of changing I would like for def skip(msg="", **kwargs):
""" ...
:kwarg bool allow_module_level: allows this function to be called at the module level, skipping the
rest of the module. Default to False.
"""
__tracebackhide__ = True
allow_module_level = kwargs.pop('allow_module_level', False)
if kwargs:
raise TypeError('unexpected keyword arguments: {}'.format(kwargs.keys())
raise Skipped(msg=msg, allow_module_level=allow_module_level) And then a test and docs. 👍 |
@nicoddemus the related PR for this issue is merged. |
thanks for the note - we try to close automatically with merging, but sometimes a reference is forgotten |
OK, thanks. |
Our policy is to close as soon as the fix is merged either on What happened is that it was merged to the |
OK. I've used the GH API to automatically identify a handful of issues (back until ~ issue 2400) that should be closed, I'll @mention you to close them. |
As discussed in #2338
@The-Compiler wrote
The Skipped exception already has allow_module_level=True as argument which is used by pytest.importorskip internally - so you should already be able to do raise pytest.skip.Exception("...", allow_module_level=True).
I think we should just expose that via pytest.skip(...) too.
The text was updated successfully, but these errors were encountered: