-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Deprecate aiohttp.pytest_plugin #10785
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
base: 3.12
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
@@ -208,6 +208,10 @@ def pytest_pyfunc_call(pyfuncitem): # type: ignore[no-untyped-def] | |||
"""Run coroutines in an event loop instead of a normal function call.""" | |||
fast = pyfuncitem.config.getoption("--aiohttp-fast") | |||
if inspect.iscoroutinefunction(pyfuncitem.function): | |||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have a stacklevel=999
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would just remove the stack trace, right? I wasn't sure the best approach, given the user's code will not be in the stack trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it would point to this plugin module as the source, which is probably not the best thing to see. Also note that deprecation warnings aren't displayed by default (which is why some projects go for UserWarning
instead). The end-users would need to have filterwarnings = error
set in their pytest.ini
to be able to see this — it may end up going unnoticed until they actually hit the removed thing. So I'm a bit turn here as (Future/Pending)DeprecationWarning
is semantically more accurate but puts us at risk of not notifying enough end-users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too worried as users should probably expect to make some changes when upgrading to v4. If they only notice at that point, that's fine.
Add deprecation warning in 3.12.