Skip to content

Commit fe9bb74

Browse files
authored
ci: capture coverage before pytest imports (#3358)
* ci: capture coverage before pytest imports Signed-off-by: Rui Luo <[email protected]> * ci: preserve pytest-cov while tracing core imports Signed-off-by: Rui Luo <[email protected]> --------- Signed-off-by: Rui Luo <[email protected]>
1 parent e96903e commit fe9bb74

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎.github/workflows/coverage.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ jobs:
186186
cd $INSTALL_ROOT
187187
$REPO_ROOT/.venv/bin/pytest -v --cov=./cuda --cov-append --cov-context=test --cov-config=$REPO_ROOT/.coveragerc $REPO_ROOT/cuda_bindings_13/tests
188188
189+
- name: Trace cuda.core imports
190+
continue-on-error: true
191+
run: |
192+
cd $INSTALL_ROOT
193+
# Trace collection-time imports before the regular pytest-cov run.
194+
"$REPO_ROOT/.venv/bin/python" -m coverage run \
195+
--append --source=./cuda --rcfile="$REPO_ROOT/.coveragerc" \
196+
-m pytest -p no:pytest_cov --collect-only -qq "$REPO_ROOT/cuda_core/tests"
197+
189198
- name: Run cuda.core tests
190199
continue-on-error: true
191200
run: |
@@ -450,6 +459,15 @@ jobs:
450459
--cov-config="$GITHUB_WORKSPACE/.coveragerc" \
451460
"$GITHUB_WORKSPACE/cuda_bindings_13/tests"
452461
462+
- name: Trace cuda.core imports
463+
continue-on-error: true
464+
run: |
465+
cd "${{ steps.install-root.outputs.INSTALL_ROOT }}"
466+
# Use a separate process so pytest-cov retains lifecycle contexts.
467+
"$GITHUB_WORKSPACE/.venv/Scripts/python" -m coverage run \
468+
--append --source=./cuda --rcfile="$GITHUB_WORKSPACE/.coveragerc" \
469+
-m pytest -p no:pytest_cov --collect-only -qq "$GITHUB_WORKSPACE/cuda_core/tests"
470+
453471
- name: Run cuda.core tests
454472
continue-on-error: true
455473
run: |

0 commit comments

Comments
 (0)