Skip to content
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

deprecation notice for 3.7 modifies global state (user warning filters) as import side-effect #1427

Closed
artgromov opened this issue Dec 2, 2023 · 1 comment · Fixed by #1428
Assignees

Comments

@artgromov
Copy link

It is impossible to filter Python37DeprecationWarning after PR #1371.

Custom libraries should not configure warning filters, because it is user project's global state. Most of the times you cannot modify import order and insert new warning filters after your library modifies them.

Environment details

  • OS: Ubuntu 22.04.3 LTS linux 5.15.0-89-generic
  • Python version: 3.7.17
  • pip version: 23.3.1
  • google-auth version: 2.24.0

Steps to reproduce

  1. install google-auth into your python3.7 project
  2. configure filterwarning rule ignore::DeprecationWarning in pytest.ini
  3. use google.auth or google.oauth2 somewhere in your project
  4. run pytest
  5. get Python37DeprecationWarning that you cannot filter
@parthea
Copy link
Contributor

parthea commented Dec 2, 2023

Hi @artgromov!

Thanks for reporting this issue. It will be fixed in #1428.

Here is the pytest.ini that I used for testing

[pytest]
filterwarnings =
    # treat all warnings as errors
    error
    ignore:After January 1, 2024, new releases of this library will drop support for Python 3.7:DeprecationWarning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants