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

Fix DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead #99

Merged
merged 1 commit into from
Feb 9, 2023

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Feb 9, 2023

Fix these deprecation warnings:

tests/test_options.py::test_social_cards_svg
  /private/tmp/sphinxext-opengraph/sphinxext/opengraph/socialcards.py:103: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    LOGGER.warn(f"[Social card] {img} cannot be an SVG image, skipping...")

tests/test_options.py::test_social_cards_svg
  /private/tmp/sphinxext-opengraph/sphinxext/opengraph/socialcards.py:108: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    LOGGER.warn(f"[Social card]: {img} file doesn't exist, skipping...")

Also use "lazy logging":

@hugovk
Copy link
Contributor Author

hugovk commented Feb 9, 2023

After this, two more:

=============================== warnings summary ===============================
tests/test_options.py::test_simple
  /opt/hostedtoolcache/Python/3.11.1/x64/lib/python3.11/site-packages/sphinx/util/images.py:6: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
    import imghdr

tests/test_options.py::test_no_configuration_dirhtml
  /home/runner/work/sphinxext-opengraph/sphinxext-opengraph/sphinxext/opengraph/socialcards.py:198: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
    fig = plt.figure(figsize=(ratio * multiple, multiple))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 35 passed, 2 warnings in 9.72s ========================

https://github.com/wpilibsuite/sphinxext-opengraph/actions/runs/4131760190/jobs/7139725073

The first is pending a fix in Sphinx: sphinx-doc/sphinx#10440

@TheTripleV TheTripleV merged commit 597ee06 into wpilibsuite:main Feb 9, 2023
@hugovk hugovk deleted the fix-DeprecationWarning branch February 9, 2023 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants