diff --git a/.github/actions/daily-perf-improver/build-steps/action.yml b/.github/actions/daily-perf-improver/build-steps/action.yml index 9668ad3..929477d 100644 --- a/.github/actions/daily-perf-improver/build-steps/action.yml +++ b/.github/actions/daily-perf-improver/build-steps/action.yml @@ -21,7 +21,7 @@ runs: shell: bash run: | echo "=== Installing dev dependencies ===" | tee -a build-steps.log - pip install pytest pytest-mock memory_profiler 2>&1 | tee -a build-steps.log + pip install pytest pytest-mock pytest-xdist memory_profiler 2>&1 | tee -a build-steps.log echo "✓ Dev dependencies installed" | tee -a build-steps.log - name: Verify installation @@ -42,7 +42,7 @@ runs: shell: bash run: | echo "=== Running test suite ===" | tee -a build-steps.log - pytest tests/ -v 2>&1 | tee -a build-steps.log + pytest tests/ -n auto -v 2>&1 | tee -a build-steps.log echo "✓ Tests completed" | tee -a build-steps.log # Allow build to continue even with test failures so the agent can analyze # failures and attempt fixes. The agent checks build-steps.log for issues. diff --git a/README.md b/README.md index ea47539..6294b10 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,49 @@ https://controld.com/dashboard/profiles/741861frakbm/filters - Python 3.13+ - `uv` (for dependency management) +## Testing + +This project includes a comprehensive test suite to ensure code quality and correctness. + +### Running Tests + +**Basic test execution:** +```bash +# Install dev dependencies first +pip install pytest pytest-mock pytest-xdist + +# Run all tests +pytest tests/ +``` + +**Parallel test execution (recommended):** +```bash +# Run tests in parallel using all available CPU cores +pytest tests/ -n auto + +# Run with specific number of workers +pytest tests/ -n 4 +``` + +**Note on parallel execution:** The test suite is currently small (~78 tests, <1s execution time), so parallel execution overhead may result in longer wall-clock time compared to sequential execution. However, pytest-xdist is included for: +- **Test isolation verification** - Ensures tests don't share state +- **Future scalability** - As the test suite grows, parallel execution will provide significant speedups +- **CI optimization** - May benefit from parallelization in CI environments with different characteristics + +### Development Workflow + +For active development with frequent test runs: +```bash +# Run tests sequentially (faster for small test suites) +pytest tests/ -v + +# Run specific test file +pytest tests/test_security.py -v + +# Run tests matching pattern +pytest tests/ -k "test_validation" -v +``` + ## Release Process This project uses manual releases via GitHub Releases. To create a new release: diff --git a/pyproject.toml b/pyproject.toml index b458c99..4cc9410 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,4 +13,5 @@ dependencies = [ dev = [ "pytest>=7.0.0", "pytest-mock>=3.10.0", + "pytest-xdist>=3.0.0", ]