Skip to content

Commit 471c966

Browse files
ritwik-gclaude
andcommitted
Add tox for consistent testing across environments
- Added tox.ini with comprehensive test environments (py3.8-3.12, lint, type-check, integration) - Updated GitHub Actions CI to use tox instead of direct pytest/uv calls - Configured tox to use uv for fast dependency management (uv-venv-runner) - Added tox to development dependencies in pyproject.toml - Updated README with tox usage examples and explanation - Environment variables properly set to disable color output in CI This ensures consistent test environments between local development and CI, eliminating the formatting assertion issues we were experiencing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b201223 commit 471c966

File tree

6 files changed

+1405
-29
lines changed

6 files changed

+1405
-29
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,17 @@ jobs:
3838
with:
3939
version: "0.5.14"
4040

41-
- name: Install dependencies
41+
- name: Install tox
4242
run: |
43-
uv sync --all-extras --dev
43+
pip install tox tox-uv
4444
45-
- name: Run unit tests
45+
- name: Run tests with tox
4646
run: |
47-
uv run pytest tests/ -v --cov=helm_values_manager --cov-report=xml --cov-report=term
48-
env:
49-
FORCE_COLOR: "0"
50-
NO_COLOR: "1"
47+
tox -e py${{ matrix.python-version }}
5148
52-
- name: Run integration tests
49+
- name: Run integration tests with tox
5350
run: |
54-
uv run pytest tests/test_integration.py -v
55-
env:
56-
FORCE_COLOR: "0"
57-
NO_COLOR: "1"
51+
tox -e integration
5852
5953
- name: Upload coverage to Codecov
6054
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
@@ -85,26 +79,18 @@ jobs:
8579
with:
8680
python-version: '3.12'
8781

88-
- name: Install uv
89-
uses: astral-sh/setup-uv@v5
90-
with:
91-
version: "0.5.14"
92-
93-
- name: Install dependencies
94-
run: |
95-
uv sync --all-extras --dev
96-
97-
- name: Run ruff check
82+
- name: Install tox
9883
run: |
99-
uv run ruff check .
84+
pip install tox
10085
101-
- name: Run ruff format check
86+
- name: Run linting with tox
10287
run: |
103-
uv run ruff format --check .
88+
tox -e lint
10489
105-
- name: Run mypy
90+
- name: Run type checking with tox
10691
run: |
107-
uv run mypy helm_values_manager --ignore-missing-imports || true
92+
tox -e type-check
93+
continue-on-error: true
10894

10995
plugin-test:
11096
runs-on: ubuntu-latest

README.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,16 +310,59 @@ This plugin is written in Python and uses:
310310
- **CLI Framework**: Typer
311311
- **Dependencies**: PyYAML for YAML generation
312312
- **Testing**: pytest with comprehensive test coverage
313+
- **Testing Tool**: tox for consistent testing across environments
313314

314315
### Building from Source
315316

316317
```bash
317318
git clone https://github.com/Zipstack/helm-values-manager
318319
cd helm-values-manager
319-
uv install
320-
uv run pytest # Run tests
320+
uv sync # Install dependencies
321321
```
322322

323+
### Running Tests
324+
325+
We use tox for consistent testing across different Python versions and environments:
326+
327+
```bash
328+
# Run tests for current Python version
329+
tox
330+
331+
# Run tests for specific Python version
332+
tox -e py311
333+
334+
# Run linting
335+
tox -e lint
336+
337+
# Run type checking
338+
tox -e type-check
339+
340+
# Run integration tests
341+
tox -e integration
342+
343+
# Run all environments
344+
tox -p # parallel execution
345+
```
346+
347+
### Alternative: Direct pytest (for development)
348+
349+
```bash
350+
# Using uv
351+
uv run pytest
352+
353+
# Using pip
354+
pip install -e .[dev]
355+
pytest
356+
```
357+
358+
### Why Tox?
359+
360+
Tox ensures consistent test environments between local development and CI:
361+
- Isolated virtual environments for each test run
362+
- Consistent dependency installation
363+
- Environment variable standardization
364+
- Cross-platform compatibility
365+
323366
## Contributing
324367

325368
1. Fork the repository

0 commit comments

Comments
 (0)