pytest

built-in
0.0% Savings
0 Commands
0 Tokens saved
2 Tests

Install

tokf install d5cd5749bb21d21feb9ee90e5e1cfc3f611ff7991318722f826c8978f3a43f40
Safety checks passed

Filter definition

command = "pytest"
description = "Run with --tb=short -q; show failures and pass/fail summary"
run = "pytest --tb=short -q {args}"

[[section]]
name = "failures"
enter = "^=+ FAILURES =+$"
exit = "^=+ short test summary"
collect_as = "failure_lines"

[[section]]
name = "summary"
match = "^(FAILED|ERROR|\\d+ passed)"
collect_as = "summary_lines"

[on_success]
extract = { pattern = "(\\d+) passed", output = "✓ pytest: {1} passed" }

[on_failure]
output = """{failure_lines | each: "{value | lines | keep: "^[>E] "}" | join: "\n"}

{summary_lines | join: "\n"}"""

[fallback]
tail = 10

Examples

test failure shows FAILED summary ~110 tokens → ~33 tokens (70% saved)
Raw output
.F...
================================== FAILURES ===================================
_________________________________ test_add ____________________________________
tests/test_math.py:10: in test_add
>     assert add(1, 2) == 4
E     AssertionError: assert 3 == 4
=========================== short test summary info ============================
FAILED tests/test_math.py::test_add - AssertionError: assert 3 == 4
1 failed, 4 passed in 0.15s
Filtered output

>     assert add(1, 2) == 4
E     AssertionError: assert 3 == 4

FAILED tests/test_math.py::test_add - AssertionError: assert 3 == 4
all tests pass shows summary ~5 tokens → ~5 tokens
Raw output
.....
5 passed in 0.12s
Filtered output
✓ pytest: 5 passed
Warning: Community filters are third-party code. Review the filter definition above before installing it in production environments.
Browse all filters