Improve test runner speed#1317
Merged
Archmonger merged 45 commits intoreactive-python:mainfrom Dec 14, 2025
Merged
Conversation
4 tasks
793af85 to
0c63629
Compare
There was a problem hiding this comment.
Pull request overview
This PR significantly improves test runner performance by enabling parallel test execution and addressing related infrastructure issues. The changes reduce test execution time from ~150 seconds to ~20 seconds locally and from ~15 minutes to ~6 minutes in CI.
Key improvements include:
- Session-scoped browser fixtures to avoid repeated Playwright startup/shutdown
- File locking mechanism to prevent race conditions during parallel module registration
- Dynamic port allocation for test servers
- React/Preact framework detection to handle double-mounting correctly
- Unique module names in tests to prevent conflicts in parallel execution
Reviewed changes
Copilot reviewed 44 out of 47 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/conftest.py | Converted fixtures to session scope, removed rebuild logic, simplified browser initialization |
| src/reactpy/testing/display.py | Added browser/backend externality tracking, improved page configuration, added visibility helper |
| src/reactpy/testing/backend.py | Implemented dynamic port allocation (port=0), added server startup validation loop |
| src/reactpy/testing/common.py | Removed clear_reactpy_web_modules_dir utility (no longer needed with locking) |
| src/reactpy/reactjs/utils.py | Added file locking for module registration, improved atomic file copy operations |
| src/reactpy/reactjs/module.py | Integrated file locking, added import_reactjs helper with framework selection |
| src/js/packages/@reactpy/client/src/bind.tsx | New file implementing framework detection and binding logic |
| src/js/packages/@reactpy/client/src/vdom.tsx | Refactored to use framework detection, fixed double-mount issues |
| src/js/packages/@reactpy/client/src/components.tsx | Fixed race conditions in binding lifecycle |
| tests/test_web/test_module.py | Made module names unique, added display fixture override, fixed browser parameter |
| tests/test_reactjs/test_modules_from_npm.py | Pinned package versions, converted to module-scoped fixtures, improved assertions |
| tests/test_reactjs/test_utils.py | Updated function names from resolve_from_* to resolve_names_from_* |
| pyproject.toml | Added parallel test support, reorganized build scripts, updated test configuration |
| .github/workflows/check.yml | Added --parallel flag to test commands |
dce1a21 to
81e8c57
Compare
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.
Description
Test runner takes a long time to run, even on a high performance Windows machine. This is largely due to Playwright startup/shutdown being slow.
This PR does the following
component_from_npmtestsOn my local machine: Reduced from ~150 seconds to ~20 seconds.
On GitHub Actions: Reduced from ~15 minutes to ~5 minutes.
Checklist
Please update this checklist as you complete each item:
By submitting this pull request I agree that all contributions comply with this project's open source license(s).