CI: pytest 9.2 fails at plugin load under -Werror on solara's websockets.legacy warning
Describe the bug
For about thirteen hours today, every CI job that passes -Werror exited 3 before collecting a single test. It is green again now, but by accident rather than by fix, and it will recur.
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
Process completed with exit code 3.
pytest 9.2.0 shipped pytest-dev/pytest#12697, which makes warnings raised while importing plugins via entry-point autoloading "captured, filtered, and reported like other warnings." Solara registers a pytest plugin by entry point, that plugin imports websockets.legacy, and websockets/legacy/__init__.py has emitted a DeprecationWarning since websockets 14.0. That warning used to escape the filter pipeline. As of pytest 9.2.0 it goes through the filters, where -Werror promotes it to an error at plugin-load time — before collection, so nothing runs at all.
Why it is green again, and why that is not reassuring
The only thing that changed is which websockets the resolver picked:
| run | websockets | build matrix |
|---|---|---|
| 2026-10-28 02:30 | 17.3 | all 6 jobs failed, 0 tests collected |
| 2026-10-28 15:15 | 13.1 | all 6 jobs passed |
13.1 predates the 14.0 deprecation, so the warning never fires. Nothing was fixed:
solara-serverrequires barewebsockets, with no upper bound:"websockets; extra == 'starlette'".- mesa pins neither
websocketsnor asolaraversion. solara/server/starlette.py:27importswebsockets.legacy.httpunconditionally.
So the next resolution that lands websockets ≥ 14 takes the whole matrix down again, with an error message that points at solara and pytest and says nothing about mesa. The coverage job would stay green throughout, because it is the only one that does not pass -Werror, which makes the failure look selective rather than environmental.
Expected behavior
A dependency resolution that does not touch mesa's code should not be able to take the test suite from "runs" to "exits 3 with zero tests collected".
To Reproduce
In a clean venv at the versions CI installed this morning:
python -m venv v && v/bin/pip install "pytest==9.2.0" "solara==1.64.1" "websockets==17.3" pytest-ipywidgets
printf 'def test_ok():\n assert True\n' > test_ok.py
v/bin/python -m pytest -Werror -Wdefault::PendingDeprecationWarning test_ok.py
Exit 3, the traceback above, zero tests collected. Dropping -Werror makes it pass.
Additional context
I have a fix ready but would rather have the approach confirmed, since it is a judgement call about mesa's warning policy rather than a mechanical repair. @quaquel
What I propose is a message-scoped ignore on the two commands that pass -Werror (build_lint.yml lines 60 and 101), in the same style as the -Wdefault::PendingDeprecationWarning carve-out already on both:
-W "ignore:websockets.legacy is deprecated:DeprecationWarning"
Verified in that venv:
| result | |
|---|---|
-Werror -Wdefault::PendingDeprecationWarning |
exit 3 at plugin load, 0 collected |
| plus the ignore | 1 passed |
unrelated DeprecationWarning raised in a test, ignore on |
still 1 failed |
The last row is the point: the filter is scoped to this warning's message, so -Werror keeps its value for every other deprecation.
Two things worth knowing before choosing:
pyproject.tomlwill not work. Afilterwarningsentry under[tool.pytest.ini_options]is overridden by the command-line-W, so with-Werrorstill on the command the run exits 3 anyway. Tested, not assumed. This has to live on the commands, or-Werrorhas to move into the ini file wholesale.- An upper bound on
websocketswould also work and is arguably more honest about the real constraint, but it pins a transitive dependency of solara's from mesa's ownpyproject.toml, which I would not do without your say-so.
Pinning pytest<9.2 is the third option. I did not pick it because it freezes the toolchain to hide something solara has to address upstream either way, but it is the most conservative of the three.
Happy to open the PR for whichever you prefer, or to drop it if you would rather wait for solara to stop importing websockets.legacy.
why did you close this?
Sorry, I should have left a note about closing. As I think is that this was already fixed by #4012 and the web sockets <14 pin in #4007.This is before I files the issue , so I thought there was nothing left to decide.
Final thoughts is that it is already fixed.Is it? If no happy to reopen and close a accordingly what's ur thought 🤔?
On Thu, 29 Oct 2026, 3:21 pm Jan Kwakkel, @.***> wrote:
quaquel left a comment (mesa/mesa#4017) https://github.com/mesa/mesa/issues/4017#issuecomment-6493474501
why did you close this?
— Reply to this email directly, view it on GitHub https://github.com/mesa/mesa/issues/4017?email_source=notifications&email_token=BL3P7AB7LTNZT7FXK7XVO4L5WMHKDA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNBZGM2DONBVGAY2M4TFMFZW63VMON2GC5DFL5RWQYLOM5S2KZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6493474501, or unsubscribe https://github.com/notifications/unsubscribe-auth/BL3P7AGT5OAXTRW2TK3TDUL5WMHKDAVCNFSNUABEKJSXA33TNF2G64TZHMZDIMRUGU3TGNZ3JFZXG5LFHM3DAOBSGQ3DEOJRGWQXMAQ . You are receiving this because you modified the open/close state.Message ID: @.***>