Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
permissions:
contents: read
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install dependencies
run: pip install httpx python-dotenv pytest pytest-mock pytest-xdist

- name: Run tests in parallel
run: pytest tests/ -n auto -v
Comment on lines +24 to +28
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency installation approach is inconsistent with other workflows in this repository. The sync.yml workflow uses pip with caching enabled (via setup-python's cache parameter), while performance.yml uses the modern uv package manager with built-in caching. This test.yml workflow uses pip without any caching, which will result in slower CI runs.

Recommend aligning with the performance.yml pattern by using uv:

  1. Add a step to install uv using astral-sh/setup-uv@v4 with enable-cache: true
  2. Replace the pip install command with "uv sync --all-extras"
  3. Update the test command to "uv run pytest tests/ -n auto -v"

This approach provides better caching, faster dependency resolution, and consistency with the modern tooling already established in performance.yml.

Suggested change
- name: Install dependencies
run: pip install httpx python-dotenv pytest pytest-mock pytest-xdist
- name: Run tests in parallel
run: pytest tests/ -n auto -v
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install dependencies
run: uv sync --all-extras
- name: Run tests in parallel
run: uv run pytest tests/ -n auto -v

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicit "-n auto" flag in the pytest command is now redundant since pyproject.toml already sets "addopts = -n auto" by default. While harmless, this duplication could cause confusion if someone later tries to modify the parallelization behavior—they would need to remember to update both locations.

Consider simplifying to "pytest tests/ -v" (or "uv run pytest tests/ -v" if switching to uv) and let the pyproject.toml configuration handle the parallelization. This reduces duplication and makes the configuration more maintainable.

Suggested change
run: pytest tests/ -n auto -v
run: pytest tests/ -v

Copilot uses AI. Check for mistakes.
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,41 +126,35 @@ This project includes a comprehensive test suite to ensure code quality and corr

### Running Tests

**Basic test execution:**
**Basic test execution (runs in parallel by default):**
```bash
# Install dev dependencies first
pip install pytest pytest-mock pytest-xdist
Comment on lines 131 to 132
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation shows installing dev dependencies with pip, but this is inconsistent with the modern tooling pattern established in the repository. The repository has uv.lock and performance.yml uses "uv sync --all-extras" for dependency installation.

Consider updating the documentation to recommend the uv approach for consistency:

# Install dev dependencies first
uv sync --all-extras

Alternatively, if pip is the intended approach for local development, document both options with a note about which is preferred.

Suggested change
# Install dev dependencies first
pip install pytest pytest-mock pytest-xdist
# Install dev dependencies first (uses uv for consistency with CI/tooling)
uv sync --all-extras

Copilot uses AI. Check for mistakes.

# Run all tests
# Run all tests (parallel execution is on by default via pyproject.toml)
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
Parallel execution is enabled by default via `addopts = "-n auto"` in `pyproject.toml`, so every `pytest` invocation automatically uses all available CPU cores.

### Development Workflow

For active development with frequent test runs:
```bash
# Run tests sequentially (faster for small test suites)
# Run tests (parallel by default)
pytest tests/ -v

# Run specific test file
pytest tests/test_security.py -v

# Run tests matching pattern
pytest tests/ -k "test_validation" -v

# Override parallel execution for a single sequential run
pytest tests/ -n0 -v
```

## Release Process
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ dev = [
"pytest-xdist>=3.0.0",
"pytest-benchmark>=4.0.0",
]

[tool.pytest.ini_options]
addopts = "-n auto"
Loading