Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Broken imports in matplotlib tests in 6.2.0 #5253

Open
Assignees
Labels
P1needed for current cycle bugsomething broken regressionthis used to work
@mgorny

Description

Since the 6.2.0 release, pytest fails to collect matplot tests:

========================================================= test session starts =========================================================
platform linux -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
rootdir: /tmp/plotly.py
configfile: pyproject.toml
plugins: anyio-4.9.0, typeguard-4.4.4
collected 3383 items / 1 error 
=============================================================== ERRORS ================================================================
________________________________ ERROR collecting plotly/matplotlylib/mplexporter/tests/test_utils.py _________________________________
ImportError while importing test module '/tmp/plotly.py/plotly/matplotlylib/mplexporter/tests/test_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.13/importlib/__init__.py:88: in import_module
 return _bootstrap._gcd_import(name[level:], package, level)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
plotly/matplotlylib/mplexporter/tests/test_utils.py:2: in <module>
 from . import plt
E ImportError: cannot import name 'plt' from 'plotly.matplotlylib.mplexporter.tests' (/tmp/plotly.py/plotly/matplotlylib/mplexporter/tests/__init__.py)
========================================================== warnings summary ===========================================================
plotly/conftest.py:4
 /tmp/plotly.py/plotly/conftest.py:4: PytestRemovedIn9Warning:
 
 The (path: py.path.local) argument is deprecated, please use (collection_path: pathlib.Path)
 see https://docs.pytest.org/en/latest/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path
tests/test_io/test_to_from_plotly_json.py:112
 /tmp/plotly.py/tests/test_io/test_to_from_plotly_json.py:112: UserWarning:
 
 no explicit representation of timezones available for np.datetime64
.venv/lib/python3.13/site-packages/pdfrw/objects/pdfstring.py:120
 /tmp/plotly.py/.venv/lib/python3.13/site-packages/pdfrw/objects/pdfstring.py:120: SyntaxWarning:
 
 invalid escape sequence '\('
.venv/lib/python3.13/site-packages/pdfrw/objects/pdfstring.py:375
 /tmp/plotly.py/.venv/lib/python3.13/site-packages/pdfrw/objects/pdfstring.py:375: SyntaxWarning:
 
 invalid escape sequence '\['
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= short test summary info =======================================================
ERROR plotly/matplotlylib/mplexporter/tests/test_utils.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================== 4 warnings, 1 error in 8.27s =====================================================

This seems to be caused by eb95abc that removed the plt import from plotly/matplotlylib/mplexporter/tests/__init__.py.

To reproduce:

pip install -e .[dev_optional] matplotlib
pytest

CC @gvwilson

Metadata

Metadata

Labels

P1needed for current cycle bugsomething broken regressionthis used to work

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /