Skip to content

Commit

Permalink
pass pytest native marker to trigger cpu and gpu tests
Browse files Browse the repository at this point in the history
Signed-off-by: Samet Akcay <[email protected]>
  • Loading branch information
samet-akcay committed Dec 12, 2024
1 parent 1a7976f commit 4e0ec91
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions .github/actions/pytest/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,19 @@ runs:
# Set device-specific pytest arguments
if [ "${{ inputs.device }}" = "cpu" ]; then
DEVICE_ARGS="-m cpu"
marker="cpu"
else
if python -c "import torch; print(torch.cuda.is_available())" | grep -q "True"; then
DEVICE_ARGS="-m 'cpu or gpu'"
else
echo "::warning::GPU requested but CUDA is not available. Running CPU tests only."
DEVICE_ARGS="-m cpu"
fi
marker="cpu,gpu" # Run both CPU and GPU tests
fi
# Run pytest with settings to show all failures
# Run pytest with pytest's native marker expression
PYTHONPATH=src pytest ${{ steps.test-scope.outputs.path }} \
--numprocesses=0 \
--durations=10 \
--durations-min=1.0 \
--timeout=${{ inputs.max-test-time }} \
--verbosity=1 \
--tb=short \
-ra \
--no-header \
${DEVICE_ARGS} | tee pytest_output.log
-m "$marker"
test_exit_code=${PIPESTATUS[0]}
Expand Down

0 comments on commit 4e0ec91

Please sign in to comment.