Skip to content

Commit 15884f3

Browse files
dugshubclaude
andcommitted
fix: Use uv run for all test commands in CI
The GitHub Actions environment uses uv to manage dependencies, but the Makefile was calling python3 directly. This caused "No module named pytest" errors. Now all test targets properly detect and use uv when available. - Updated all test targets to use uv run when available - Falls back to python3 -m for environments without uv - Fixes CI failures across all test jobs 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 18f01bb commit 15884f3

File tree

1 file changed

+55
-11
lines changed

1 file changed

+55
-11
lines changed

Makefile

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,35 @@ install:
3636

3737
# Run all tests
3838
test:
39-
PYTHONPATH=src python3 -m pytest tests/ -v
39+
@if command -v uv > /dev/null 2>&1; then \
40+
PYTHONPATH=src uv run pytest tests/ -v; \
41+
else \
42+
PYTHONPATH=src python3 -m pytest tests/ -v; \
43+
fi
4044

4145
# Run unit tests only
4246
test-unit:
43-
PYTHONPATH=src python3 -m pytest tests/unit/ -v
47+
@if command -v uv > /dev/null 2>&1; then \
48+
PYTHONPATH=src uv run pytest tests/unit/ -v; \
49+
else \
50+
PYTHONPATH=src python3 -m pytest tests/unit/ -v; \
51+
fi
4452

4553
# Run integration tests only
4654
test-integration:
47-
PYTHONPATH=src python3 -m pytest tests/integration/ -v
55+
@if command -v uv > /dev/null 2>&1; then \
56+
PYTHONPATH=src uv run pytest tests/integration/ -v; \
57+
else \
58+
PYTHONPATH=src python3 -m pytest tests/integration/ -v; \
59+
fi
4860

4961
# Run tests with coverage
5062
test-coverage:
51-
PYTHONPATH=src python3 -m pytest tests/ --cov=cli_patterns --cov-report=term-missing --cov-report=html
63+
@if command -v uv > /dev/null 2>&1; then \
64+
PYTHONPATH=src uv run pytest tests/ --cov=cli_patterns --cov-report=term-missing --cov-report=html; \
65+
else \
66+
PYTHONPATH=src python3 -m pytest tests/ --cov=cli_patterns --cov-report=term-missing --cov-report=html; \
67+
fi
5268

5369
# Run specific test file
5470
test-file:
@@ -65,7 +81,11 @@ lint:
6581

6682
# Type check with mypy
6783
type-check:
68-
PYTHONPATH=src python3 -m mypy src/cli_patterns --strict
84+
@if command -v uv > /dev/null 2>&1; then \
85+
PYTHONPATH=src uv run mypy src/cli_patterns --strict; \
86+
else \
87+
PYTHONPATH=src python3 -m mypy src/cli_patterns --strict; \
88+
fi
6989

7090
# Format code
7191
format:
@@ -94,11 +114,19 @@ all: format lint type-check test
94114

95115
# Quick test for current work
96116
quick:
97-
PYTHONPATH=src python3 -m pytest tests/unit/ui/design/ -v
117+
@if command -v uv > /dev/null 2>&1; then \
118+
PYTHONPATH=src uv run pytest tests/unit/ui/design/ -v; \
119+
else \
120+
PYTHONPATH=src python3 -m pytest tests/unit/ui/design/ -v; \
121+
fi
98122

99123
# Watch tests (requires pytest-watch)
100124
watch:
101-
PYTHONPATH=src python3 -m pytest-watch tests/ --clear
125+
@if command -v uv > /dev/null 2>&1; then \
126+
PYTHONPATH=src uv run pytest-watch tests/ --clear; \
127+
else \
128+
PYTHONPATH=src python3 -m pytest-watch tests/ --clear; \
129+
fi
102130

103131
# Run pre-commit hooks
104132
pre-commit:
@@ -110,16 +138,32 @@ pre-commit-install:
110138

111139
# Run tests by marker
112140
test-parser:
113-
PYTHONPATH=src python3 -m pytest tests/ -m parser -v
141+
@if command -v uv > /dev/null 2>&1; then \
142+
PYTHONPATH=src uv run pytest tests/ -m parser -v; \
143+
else \
144+
PYTHONPATH=src python3 -m pytest tests/ -m parser -v; \
145+
fi
114146

115147
test-executor:
116-
PYTHONPATH=src python3 -m pytest tests/ -m executor -v
148+
@if command -v uv > /dev/null 2>&1; then \
149+
PYTHONPATH=src uv run pytest tests/ -m executor -v; \
150+
else \
151+
PYTHONPATH=src python3 -m pytest tests/ -m executor -v; \
152+
fi
117153

118154
test-design:
119-
PYTHONPATH=src python3 -m pytest tests/ -m design -v
155+
@if command -v uv > /dev/null 2>&1; then \
156+
PYTHONPATH=src uv run pytest tests/ -m design -v; \
157+
else \
158+
PYTHONPATH=src python3 -m pytest tests/ -m design -v; \
159+
fi
120160

121161
test-fast:
122-
PYTHONPATH=src python3 -m pytest tests/ -m "not slow" -v
162+
@if command -v uv > /dev/null 2>&1; then \
163+
PYTHONPATH=src uv run pytest tests/ -m "not slow" -v; \
164+
else \
165+
PYTHONPATH=src python3 -m pytest tests/ -m "not slow" -v; \
166+
fi
123167

124168
test-components:
125169
PYTHONPATH=src python3 -m pytest tests/ -m "parser or executor or design" -v

0 commit comments

Comments
 (0)