-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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.Instance not raising deprecation warning like intended? #9347
Comments
If we can make it work, I think a deprecation warning definitely is preferable to removal. @bluetech do you have an idea why this wasn't triggered as intended? Maybe the access happened before pytest sets up its warning filters or something? |
If we only trigger on usage we may miss on instance checks or pathological subclasses, I'll give the details a look later today |
Thanks for tracking it!
|
Looking at the code the warning is on import, so it should work. This may well be some python warning strangeness (they seem to work in unexpected ways sometimes) |
I did a initial skim, we may need to revised how warnings are handled in setuptools plugin loading. I suspect the sqlalchemy plugin gets imported without warning capture being in place We can harden the code by triggering the warning on instance type checks as well |
We ought to add a local testcase that tries a fake setuptools plugin and one using the |
So I assume |
(BTW, @CaselIT, you should apply the following patch if you're able -- pytest 7 warns about it (it has always been a mistake). diff --git a/lib/sqlalchemy/testing/plugin/plugin_base.py b/lib/sqlalchemy/testing/plugin/plugin_base.py
index d79931b91..7bc88a14b 100644
--- a/lib/sqlalchemy/testing/plugin/plugin_base.py
+++ b/lib/sqlalchemy/testing/plugin/plugin_base.py
@@ -86,7 +86,7 @@ def setup_options(make_option):
make_option(
"--dbdriver",
action="append",
- type="string",
+ type=str,
dest="dbdriver",
help="Additional database drivers to include in tests. "
"These are linked to the existing database URLs by the " ) |
It seems that using |
sqlalchemy sets pytest warnings to once: If it's set to The pytest stuff doesn't work because sqlalchemy disables the warnings plugin: So I think everything is working as intended. |
Thanks for debugging. That seems to have been added due to #2430, but I find it surprising that it will suppress all warning. |
thanks, this warning and another raised by python was also masked by the I don't understand what |
It doesn't suppress all warnings, unless I'm missing something.
By default, Python ignores deprecation warnings. You can set |
It seems to be something sqlalchemy does. Not sure what yet, but I'll investigate. Trying with an empty configuration does raise the warning when importing Instance. Sorry for the noise |
No worries! I'll take a false alarm before a release rather than a real alarm a few minutes after the release any day 😉 Thanks to everyone helping to debug this! I suppose we can close this one then? |
I think it's working as intended, so closing. |
Personally I think it's would be better to just remove this, since trying with sqlalchemy returned no warning whatsoever, just no collection.
If it was removed we would have at least an attribute error to go by.
See also #9343 (comment)
To reproduce:
will run and print
no tests ran in 13.57s
, so the warning seems to not triggerOriginally posted by @CaselIT in #9277 (comment)
The text was updated successfully, but these errors were encountered: