@@ -138,24 +138,48 @@ jobs:
138
138
if : ${{ matrix.tool == 'tox' }}
139
139
id : tox
140
140
run : |
141
- echo "Running tox for changed files..."
141
+ echo "Running tox integration for changed files..."
142
142
changed_files="${{ needs.check_changes.outputs.files }}"
143
143
144
- # Create a temporary tox configuration for the changed files
145
- echo "[testenv]" > tox_pr.ini
144
+ # Create a temporary tox configuration that extends the original one
145
+ echo "[tox]" > tox_pr.ini
146
+ echo "envlist = py312" >> tox_pr.ini
147
+ echo "skip_missing_interpreters = true" >> tox_pr.ini
148
+
149
+ echo "[testenv]" >> tox_pr.ini
150
+ echo "setenv =" >> tox_pr.ini
151
+ echo " COVERAGE_FILE = .coverage.{envname}" >> tox_pr.ini
152
+ echo "deps =" >> tox_pr.ini
153
+ echo " -r requirements-dev.txt" >> tox_pr.ini
154
+ echo "allowlist_externals =" >> tox_pr.ini
155
+ echo " pytest" >> tox_pr.ini
146
156
echo "commands =" >> tox_pr.ini
147
157
148
- # Add specific testing commands for each changed file
158
+ # For tox, let's focus on integration tests and coverage only
159
+ # to avoid duplicating what individual matrix jobs are doing
160
+
161
+ # Add coverage-focused test commands
149
162
for file in $changed_files; do
150
163
if [[ $file == *.py ]]; then
151
- echo " pytest {posargs} -xvs $file" >> tox_pr.ini
152
- echo " flake8 $file" >> tox_pr.ini
153
- echo " mypy --ignore-missing-imports $file" >> tox_pr.ini
164
+ # Run coverage tests for implementation files
165
+ if [[ $file == patterns/* ]]; then
166
+ module_name=$(basename $file .py)
167
+ echo " pytest --cov=patterns/ --cov-append tests/ -k \"$module_name\"" >> tox_pr.ini
168
+ fi
169
+
170
+ # Run test files directly if modified
171
+ if [[ $file == tests/* ]]; then
172
+ echo " pytest --cov=patterns/ --cov-append $file" >> tox_pr.ini
173
+ fi
154
174
fi
155
175
done
156
176
157
- # Run tox with the temporary configuration
158
- tox -c tox_pr.ini || true
177
+ # Add coverage report command
178
+ echo " coverage report" >> tox_pr.ini
179
+
180
+ # Run tox with the custom configuration
181
+ echo "Running tox with custom PR configuration..."
182
+ tox -c tox_pr.ini
159
183
160
184
summary :
161
185
needs : [check_changes, lint]
0 commit comments