Repository navigation
Stop pytest 9.2 from failing at plugin load on solara's websockets warning - #4012
Merged
Merged
Conversation
…rning
Every CI job that runs pytest with `-Werror` now dies before collecting a
single test:
Error while loading plugin "pytest11".
solara/test/pytest_plugin.py:29: from solara.server.starlette import ServerStarlette
solara/server/starlette.py:27: import websockets.legacy.http
E DeprecationWarning: websockets.legacy is deprecated
pytest 9.2.0 shipped pytest-dev/pytest#12697, which makes warnings raised
while importing entry-point plugins go through the normal filter pipeline.
Solara registers a pytest plugin by entry point, that plugin imports
`websockets.legacy`, and `websockets.legacy.__init__` has emitted a
`DeprecationWarning` since websockets 14.0. Under `-Werror` it is now
promoted to an error, so pytest exits 3 with zero tests run.
Nothing in mesa changed. `build (ubuntu, 3.14)` was green on `main` at
2026-10-27 10:15 and has failed on every run since, and the `coverage` job
is the only one still passing because it is the only one that does not pass
`-Werror`.
Add a message-scoped ignore for that one warning, in the same style as the
`-Wdefault::PendingDeprecationWarning` carve-out already on both commands.
Verified against the versions CI installs (pytest 9.2.0, solara 1.64.1,
websockets 17.3):
- `-Werror` alone: exit 3 at plugin load
- with the ignore: collection and the run proceed normally
- an unrelated `DeprecationWarning` raised in a test still fails, so
`-Werror` keeps its value
A `filterwarnings` entry in `pyproject.toml` does not work here: a
command-line `-W` takes precedence over the ini option, so the `-Werror`
on these commands overrides it and the run still exits 3. Tested.
Co-Authored-By: Claude Opus 5 <[email protected]>
quaquel
approved these changes
Oct 28, 2026
Member
|
thanks for the quick fix! |
EwoutH
pushed a commit
that referenced
this pull request
Oct 28, 2026
…rning (#4012) Every CI job that runs pytest with `-Werror` now dies before collecting a single test: Error while loading plugin "pytest11". solara/test/pytest_plugin.py:29: from solara.server.starlette import ServerStarlette solara/server/starlette.py:27: import websockets.legacy.http E DeprecationWarning: websockets.legacy is deprecated pytest 9.2.0 shipped pytest-dev/pytest#12697, which makes warnings raised while importing entry-point plugins go through the normal filter pipeline. Solara registers a pytest plugin by entry point, that plugin imports `websockets.legacy`, and `websockets.legacy.__init__` has emitted a `DeprecationWarning` since websockets 14.0. Under `-Werror` it is now promoted to an error, so pytest exits 3 with zero tests run. Nothing in mesa changed. `build (ubuntu, 3.14)` was green on `main` at 2026-10-27 10:15 and has failed on every run since, and the `coverage` job is the only one still passing because it is the only one that does not pass `-Werror`. Add a message-scoped ignore for that one warning, in the same style as the `-Wdefault::PendingDeprecationWarning` carve-out already on both commands. Verified against the versions CI installs (pytest 9.2.0, solara 1.64.1, websockets 17.3): - `-Werror` alone: exit 3 at plugin load - with the ignore: collection and the run proceed normally - an unrelated `DeprecationWarning` raised in a test still fails, so `-Werror` keeps its value A `filterwarnings` entry in `pyproject.toml` does not work here: a command-line `-W` takes precedence over the ini option, so the `-Werror` on these commands overrides it and the run still exits 3. Tested. Co-authored-by: Claude Opus 5 <[email protected]> (cherry picked from commit 811d330)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every CI job that runs pytest with
-Werrorcurrently dies before collecting a single test:Cause
pytest 9.2.0shipped pytest-dev/pytest#12697 — warnings raised while importing plugins via entry-point autoloading "are now captured, filtered, and reported like other warnings."Solara registers a pytest plugin by entry point. That plugin imports
websockets.legacy, whose__init__has emitted aDeprecationWarningsince websockets 14.0. Previously that warning escaped the filter pipeline and was harmless; as of pytest 9.2.0 it goes through the filters, where-Werrorpromotes it to an error and pytest exits 3 with zero tests run.Nothing in mesa changed. Two pieces of evidence:
build (ubuntu, 3.14)was green onmainat 2026-10-27 10:15 and has failed on every run since.coverageis the only job still passing, and the only one that does not pass-Werror— it runspython -Im pytest -p pytest_cov --cov ... tests/.Fix
A message-scoped ignore on the two commands that pass
-Werror, in the same style as the-Wdefault::PendingDeprecationWarningcarve-out already on both:Verified
Against the exact versions CI installs (pytest 9.2.0, solara 1.64.1, websockets 17.3), in a clean venv:
-Werror -Wdefault::PendingDeprecationWarning1 passed— collection and run proceedDeprecationWarningraised inside a test, with the ignore on1 failedThat last row is the one that matters: the ignore is scoped to this warning's message, so
-Werrorkeeps its value for everything else.Alternative that does not work
Putting it in
pyproject.tomlinstead:A command-line
-Wtakes precedence over the ini option, so the-Werroralready on these commands overrides it and the run still exits 3. Tested, not assumed.Scope
CI only; no library code touched. Pinning
pytest<9.2would also turn CI green, but it freezes the toolchain to hide a warning that solara will have to address upstream either way.