Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables running the Python test suite under pytest-xdist (parallel execution) and adds a few determinism fixes to avoid order-dependent failures when tests run concurrently.
Changes:
- Add
pytest-xdistto the test dependency group and enable-n autoin CI workflows. - Add a global test fixture intended to ensure
__main__.__file__is set in xdist workers. - Make ordering deterministic in a runtime completion test and in marimo’s pytest AST test-class generation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/conftest.py |
Adds an autouse fixture to patch __main__.__file__ for xdist workers. |
tests/_runtime/test_complete.py |
Sorts collected callables for deterministic parametrization order. |
pyproject.toml |
Adds pytest-xdist to the test dependency group. |
marimo/_ast/pytest.py |
Sorts defs to make generated pytest class attributes deterministic. |
.github/workflows/test_cli.yaml |
Runs CLI tests with pytest -n auto. |
.github/workflows/test_be.yaml |
Runs backend tests with pytest -n auto across dependency matrices. |
.github/workflows/dev_build.yaml |
Adds a job timeout limit. |
- CLI tests: use -p no:xdist since they start real servers with port binding and have race conditions under parallel execution - Windows backend: disable xdist due to spawn-based multiprocessing causing worker crashes when tests modify __main__ - Improve _ensure_main_has_file fixture: use shutil.which for robust path resolution, properly restore original state in cleanup
akshayka
reviewed
Mar 28, 2026
Contributor
akshayka
left a comment
There was a problem hiding this comment.
Nice. Can you leave a comment documenting the issue on Windows, with a TODO to fix it?
These are the tests I saw that failed.
FAILED tests/_islands/test_island_generator.py::test_build - worker 'gw1' crashed while running 'tests/_islands/test_island_generator.py::test_build'
FAILED tests/_messaging/test_streams.py::test_import_multiprocessing - worker 'gw0' crashed while running 'tests/_messaging/test_streams.py::test_import_multiprocessing'
FAILED tests/_server/api/endpoints/test_ai.py::TestOpenAiEndpoints::test_completion_without_token - worker 'gw2' crashed while running 'tests/_server/api/endpoints/test_ai.py::TestOpenAiEndpoints::test_completion_without_token'
FAILED tests/_server/test_session_manager.py::test_create_session_new - worker 'gw4' crashed while running 'tests/_server/test_session_manager.py::test_create_session_new'
FAILED tests/_islands/test_island_generator.py::test_render - worker 'gw5' crashed while running 'tests/_islands/test_island_generator.py::test_render'
FAILED tests/_server/test_session_manager.py::test_create_session_absolute_url - worker 'gw6' crashed while running 'tests/_server/test_session_manager.py::test_create_session_absolute_url'
FAILED tests/_islands/test_island_generator.py::test_render_multiline_markdown - worker 'gw7' crashed while running 'tests/_islands/test_island_generator.py::test_render_multiline_markdown'
FAILED tests/_server/test_session_manager.py::test_create_session_with_script_config_overrides - worker 'gw8' crashed while running 'tests/_server/test_session_manager.py::test_create_session_with_script_config_overrides'
FAILED tests/_server/test_session_manager.py::test_recents_touch_called_on_session_create - worker 'gw9' crashed while running 'tests/_server/test_session_manager.py::test_recents_touch_called_on_session_create'
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.
This pull request introduces parallel test execution using
pytest-xdistacross the codebase, improves test reliability with a new fixture, and makes minor improvements to code consistency and determinism. The key changes are grouped below.Test Parallelization and Workflow Updates:
pytest-xdistas a test dependency inpyproject.tomlto enable parallel test execution.test_be.yaml,test_cli.yaml) to use the-n autoflag, enabling parallel test runs for improved CI speed. [1] [2] [3] [4]dev_build.yamlto 20 minutes to accommodate potentially longer parallel builds.Test Reliability and Infrastructure:
tests/conftest.pyto ensure__main__.__file__is set for each worker, preventing failures in tests that rely on this attribute when running withpytest-xdist.Code Consistency and Determinism:
marimo/_ast/pytest.pyfor consistent test behavior.tests/_runtime/test_complete.pyby sorting them by module and qualified name.