Fix: Configurable behavior when no tests match#687
Fix: Configurable behavior when no tests match#687OmChillure wants to merge 6 commits intokarva-dev:mainfrom
Conversation
Merging this PR will improve performance by 10.96%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | karva_benchmark |
24.7 s | 22.3 s | +10.96% |
Comparing OmChillure:fix-configurable-behaviour-when-no-tests-match-no-test (3e62a94) with main (faef1bf)
|
Thank you I've just found out that neatest has some nice functionality And auto essentially means
So if we could add the env var Weirdly neatest doesn't support this in configuration file, but I like that you've added that, we should definitely support config. |
yup added this |
|
Hey @MatthewMckee4 the "pre commit" ci is failing, I guess there is a bug in that test or smtg? Can you take a look please !! Thank you |
|
It's just failing due to formatting |
ahh its was just cargo fmt, i thought it was something else, my fault :( fixed if you can check ! thanks |
Fixes #553
Summary
This PR implements configurable behavior when no tests are collected, letting users control the exit status via
--no-tests:--no-tests=fail— exit non-zero with an error message (default)--no-tests=pass— exit 0 silently, useful in CI where filters may legitimately match nothing--no-tests=warn— exit 0 and print a warningA
NoTestsModeenum (pass | warn | fail) was added tokarva_metadataand wired through the CLI, options, and settings. Theno_tests_matched_filtershelper checks whether zero tests ran and dispatches to the correct mode. The default isfail, preserving existing behavior.The option can also be set persistently in
pyproject.toml:NoTests follows the same pattern as RunIgnored and TerminalColor with an as_str method and value_name = "WHEN" on the clap argument for cleaner --help output.
Test Plan
Added
filterset_test_no_matches,filterset_test_no_matches_pass, andfilterset_test_no_matches_warnintegration tests covering all three modes against a file with no test functions. Updated thefilterset_tag_no_matchessnapshot to reflect the new default fail behavior.