Commit bb8e48f
committed
refactor: Use pytest JUnit XML for reliable test count parsing
Old approach: Parse text output with fragile sed regex
- Fragile: '===== 43 passed in X.XXs =====' format could change
- Complex: Greedy matching issues, cross-platform sed differences
- Error-prone: Multiple patterns to maintain
New approach: Use pytest --junitxml for structured output
- Reliable: XML format is stable and documented
- Simple: grep -oE extracts attributes directly
- Standard: JUnit XML is pytest's native output format
XML structure:
<testsuite tests="43" failures="0" skipped="0">
Parsing:
- tests=: Total tests run (passed + failed)
- failures=: Failed tests
- skipped=: Skipped tests
- passed = tests - failures - skipped
Benefits:
- No regex fragility
- Works on all platforms (grep -oE is POSIX)
- More maintainable
- Can add test result artifacts later1 parent b1ac911 commit bb8e48f
1 file changed
Lines changed: 18 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
222 | 218 | | |
223 | 219 | | |
224 | 220 | | |
225 | | - | |
226 | 221 | | |
| 222 | + | |
227 | 223 | | |
228 | 224 | | |
229 | 225 | | |
230 | 226 | | |
231 | 227 | | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 228 | + | |
236 | 229 | | |
237 | | - | |
| 230 | + | |
238 | 231 | | |
239 | 232 | | |
240 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
241 | 237 | | |
242 | 238 | | |
243 | 239 | | |
| |||
0 commit comments