You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(dev): run the test suite on parallel workers - #40
python3 run_tests.py now runs one worker per CPU, taking the suite from 48s to about 8s locally with the same results as a serial run. -j 1 keeps the old in-process behaviour, and coverage run stays in-process automatically.
Running tests out of order exposed a few that depended on each other, so those now set up and restore their own state.
This also fixes a real bug: on a cold cache, opentab doctor wrote to the cache dir despite its "creates nothing" promise.
Tested on macOS with Python 3.9, 3.12, 3.14 and 3.15, including shuffled runs and every test run alone. This PR's CI is the first Linux run.
Summary by CodeRabbit
New Features
Test runs can now be filtered by name and configured to use a chosen number of workers. Coverage runs and single-test runs execute in one process.
Test output now distinguishes skipped tests from passes and reports failures, including when a worker exits unexpectedly.
Improvements
Diagnostic reports no longer write parsed catalog data to the cache.
Documentation
Updated test-running guidance to explain worker behavior, coverage, and failure reporting.
The test runner now supports filtered test selection and configurable in-process or parallel execution. Tests also update fixture setup and cleanup. Pricing catalog parsing gains a read-only cache context, which the doctor report uses.
Changes: Parallel test execution
Layer / File(s)
Summary
Runner options and test selection run_tests.py, AGENTS.md, CONTRIBUTING.md
The runner accepts test-name filters and a worker count. It selects in-process execution for one worker, defaults to one worker under coverage, and documents worker behavior and debugging commands.
Worker execution and result reporting run_tests.py, tests/test_run_tests.py
Spawned workers receive test names, capture output, and return outcomes. The runner reports worker failures and continues assigning tests. Integration tests cover selection, outcomes, worker exits, and job-count validation.
Test fixture and cleanup updates
Layer / File(s)
Summary
Test fixture setup and cleanup tests/test_notes.py, tests/test_sources.py, tests/test_tui_whatif.py, tests/test_util.py
Tests use a helper to write notes fixtures, set a SQLite timeout, scope curses patches, and remove HERDR_PANE_ID during cleanup.
Read-only pricing catalog cache
Layer / File(s)
Summary
Read-only catalog parsing and doctor report src/opentab/accounting/pricing.py, src/opentab/cli/doctor.py, tests/test_pricing.py, tests/test_doctor.py
read_only_catalogs() disables catalog-cache writes while preserving cache reads, then restores the prior setting. build_report uses the context, and tests cover cache behavior and report setup.
sequenceDiagram
participant TestRunner as run_tests.main
participant Orchestrator as run_parallel
participant Worker
participant TestCase as run_case
TestRunner->>Orchestrator: selected test names and worker count
Orchestrator->>Worker: assign test name
Worker->>TestCase: execute test
TestCase-->>Worker: outcome and traceback
Worker-->>Orchestrator: result and captured output
Orchestrator-->>TestRunner: report result
Loading
Possibly related PRs
hamidi-dev/opentab#37: Adds parsed pricing-catalog caching, which this change supports with a read-only cache context.
hamidi-dev/opentab#39: Extends parsed pricing-catalog caching, which this change also modifies.
Merge Risk: Low · up to bbacf
Parallel execution has bounded diagnostic and cleanup gaps, and overlapping read-only contexts can incorrectly enable cache writes. These warrant owner awareness and follow-up, but the evidence does not establish a broad failure of ordinary suite execution.
Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
python3 run_tests.pynow runs one worker per CPU, taking the suite from 48s to about 8s locally with the same results as a serial run.-j 1keeps the old in-process behaviour, andcoverage runstays in-process automatically.Running tests out of order exposed a few that depended on each other, so those now set up and restore their own state.
This also fixes a real bug: on a cold cache,
opentab doctorwrote to the cache dir despite its "creates nothing" promise.Tested on macOS with Python 3.9, 3.12, 3.14 and 3.15, including shuffled runs and every test run alone. This PR's CI is the first Linux run.
Summary by CodeRabbit