Skip to content

Commit b1ac911

Browse files
committed
fix: Sed pattern was too greedy, eating first digit of test count
Issue: sed pattern '.*=.*\([0-9][0-9]*\) passed' was matching: - Input: '===== 43 passed in 34.95s =====' - Matched: '===== 4' (greedy .* consumed the 4) - Captured: '3' (only last digit) Solution: Match space before number instead of '=' - Pattern: '.* \([0-9][0-9]*\) passed' - Matches: '===== 43 passed' - Captures: '43' (all digits after last space) Result: All platforms now show correct counts (43 passed, not 3)
1 parent ff02cbb commit b1ac911

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/test-python-bindings.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ jobs:
215215
216216
# Count results (cross-platform: use sed instead of grep -P)
217217
# Format: "===== 43 passed, 2 skipped in 1.23s =====" or "===== 43 passed in 1.23s ====="
218-
PASSED=$(sed -n 's/.*=.*\([0-9][0-9]*\) passed.*/\1/p' pytest-output.txt | tail -1)
219-
SKIPPED=$(sed -n 's/.*=.*\([0-9][0-9]*\) skipped.*/\1/p' pytest-output.txt | tail -1)
220-
FAILED=$(sed -n 's/.*=.*\([0-9][0-9]*\) failed.*/\1/p' pytest-output.txt | tail -1)
218+
# Use [^0-9] to match non-digit before number to avoid greedy matching
219+
PASSED=$(sed -n 's/.* \([0-9][0-9]*\) passed.*/\1/p' pytest-output.txt | tail -1)
220+
SKIPPED=$(sed -n 's/.* \([0-9][0-9]*\) skipped.*/\1/p' pytest-output.txt | tail -1)
221+
FAILED=$(sed -n 's/.* \([0-9][0-9]*\) failed.*/\1/p' pytest-output.txt | tail -1)
221222
222223
# Default to 0 if not found
223224
PASSED=${PASSED:-0}

0 commit comments

Comments
 (0)