Repository navigation
Broken imports in matplotlib tests in 6.2.0 #5253
Copy link
Copy link
Closed
Labels
P1needed for current cycleneeded for current cyclebugsomething brokensomething brokenregressionthis used to workthis used to work
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1needed for current cycleneeded for current cyclebugsomething brokensomething brokenregressionthis used to workthis used to work
Activity
[-]Broken imports in matplotlib tests in 6.0.0[/-][+]Broken imports in matplotlib tests in 6.2.0[/+]mgorny commentedon Jun 27, 2025
Sorry, meant 6.2.0.
janosh commentedon Jun 29, 2025
i also started getting broken internal imports
downgrading to
plotly==6.1.1fixes the issuegvwilson commentedon Jul 2, 2025
thanks for the report and confirmation - I'll try to prioritize work on this problem this week.
janosh commentedon Jul 10, 2025
from my side this issue is resolved thanks to janosh/pymatviz#310. no need to restore
SymbolValidatororDashValidatorbut i recommend the v6.2.0 release notes be updated to document this breaking change!mgorny commentedon Aug 13, 2025
The test suite is still broken in 6.3.0, though.
Fix broken import in `mplexporter` tests
mgorny commentedon Aug 13, 2025
Filed #5322 to fix this.