-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[UX?] Facilitate weird DeprecationWarning implementations #7524
Comments
this is a structural issue the setoption in python is ignored because cryptography is not yet importable |
i believe you need the ignore line twice, first to trigger the import before the error spec then after the error spec to ensure it works its unfortunate the warning triggers directly on import |
If I understand you correctly, you're suggesting that I do this: filterwarnings =
ignore:Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.:cryptography.utils.CryptographyDeprecationWarning:cryptography
error
ignore:Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.:cryptography.utils.CryptographyDeprecationWarning:cryptography It does work (tried under pytest 4.6.11 because this is related to Python 2). But then, it also works if I don't have that second ignore, as in: filterwarnings =
ignore:Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.:cryptography.utils.CryptographyDeprecationWarning:cryptography
error I assume that is because the imported modules are cached and the following imports don't emit warnings because the module is not interpreted for the second time. |
Exactly |
Looks like there's no way to improve this programmatically.
|
Yesterday cryptography published an update that injects a
DeprecationWarning
right into their package__init__
. TheirDeprecationWarning
is custom and is declared in their own project, incryptography.utils
submodule.So adding
filterwarnings = error ignore:Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.:cryptography.utils.CryptographyDeprecationWarning
makes pytest explode:
To be fair, it's the behavior of the interpreter:
Does pytest try to import the ignored category on its own on startup? Is there any way it could work around such cases?
The text was updated successfully, but these errors were encountered: