-
-
Notifications
You must be signed in to change notification settings - Fork 4
Add --run-ignored option
#674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MatthewMckee4
merged 4 commits into
karva-dev:main
from
OmChillure:fix-run-skipped-test-with-run-ignored
Apr 12, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,5 +9,6 @@ mod durations; | |
| mod extensions; | ||
| mod filterset; | ||
| mod last_failed; | ||
| mod run_ignored; | ||
| mod version; | ||
| mod watch; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| use insta_cmd::assert_cmd_snapshot; | ||
|
|
||
| use crate::common::TestContext; | ||
|
|
||
| const MIXED_TESTS: &str = r" | ||
| import karva | ||
|
|
||
| @karva.tags.skip | ||
| def test_skipped(): | ||
| assert False | ||
|
|
||
| @karva.tags.skip('reason here') | ||
| def test_skipped_with_reason(): | ||
| assert False | ||
|
|
||
| def test_normal(): | ||
| assert True | ||
| "; | ||
|
|
||
| #[test] | ||
| fn runignored_runs_only_skipped_tests() { | ||
| let context = TestContext::with_file("test.py", MIXED_TESTS); | ||
| assert_cmd_snapshot!(context.command_no_parallel().arg("--run-ignored").arg("only"), @" | ||
| success: false | ||
| exit_code: 1 | ||
| ----- stdout ----- | ||
| Starting 3 tests across 1 worker | ||
| FAIL [TIME] test::test_skipped | ||
| FAIL [TIME] test::test_skipped_with_reason | ||
| SKIP [TIME] test::test_normal | ||
|
|
||
| diagnostics: | ||
|
|
||
| error[test-failure]: Test `test_skipped` failed | ||
| --> test.py:5:5 | ||
| | | ||
| 4 | @karva.tags.skip | ||
| 5 | def test_skipped(): | ||
| | ^^^^^^^^^^^^ | ||
| 6 | assert False | ||
| | | ||
| info: Test failed here | ||
| --> test.py:6:5 | ||
| | | ||
| 4 | @karva.tags.skip | ||
| 5 | def test_skipped(): | ||
| 6 | assert False | ||
| | ^^^^^^^^^^^^ | ||
| 7 | | ||
| 8 | @karva.tags.skip('reason here') | ||
| | | ||
|
|
||
| error[test-failure]: Test `test_skipped_with_reason` failed | ||
| --> test.py:9:5 | ||
| | | ||
| 8 | @karva.tags.skip('reason here') | ||
| 9 | def test_skipped_with_reason(): | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| 10 | assert False | ||
| | | ||
| info: Test failed here | ||
| --> test.py:10:5 | ||
| | | ||
| 8 | @karva.tags.skip('reason here') | ||
| 9 | def test_skipped_with_reason(): | ||
| 10 | assert False | ||
| | ^^^^^^^^^^^^ | ||
| 11 | | ||
| 12 | def test_normal(): | ||
| | | ||
|
|
||
| ──────────── | ||
| Summary [TIME] 3 tests run: 0 passed, 2 failed, 1 skipped | ||
|
|
||
| ----- stderr ----- | ||
| "); | ||
| } | ||
|
|
||
| #[test] | ||
| fn runignored_all_runs_skipped_alongside_normal() { | ||
| let context = TestContext::with_file("test.py", MIXED_TESTS); | ||
| assert_cmd_snapshot!(context.command_no_parallel().arg("--run-ignored").arg("all"), @" | ||
| success: false | ||
| exit_code: 1 | ||
| ----- stdout ----- | ||
| Starting 3 tests across 1 worker | ||
| FAIL [TIME] test::test_skipped | ||
| FAIL [TIME] test::test_skipped_with_reason | ||
| PASS [TIME] test::test_normal | ||
|
|
||
| diagnostics: | ||
|
|
||
| error[test-failure]: Test `test_skipped` failed | ||
| --> test.py:5:5 | ||
| | | ||
| 4 | @karva.tags.skip | ||
| 5 | def test_skipped(): | ||
| | ^^^^^^^^^^^^ | ||
| 6 | assert False | ||
| | | ||
| info: Test failed here | ||
| --> test.py:6:5 | ||
| | | ||
| 4 | @karva.tags.skip | ||
| 5 | def test_skipped(): | ||
| 6 | assert False | ||
| | ^^^^^^^^^^^^ | ||
| 7 | | ||
| 8 | @karva.tags.skip('reason here') | ||
| | | ||
|
|
||
| error[test-failure]: Test `test_skipped_with_reason` failed | ||
| --> test.py:9:5 | ||
| | | ||
| 8 | @karva.tags.skip('reason here') | ||
| 9 | def test_skipped_with_reason(): | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| 10 | assert False | ||
| | | ||
| info: Test failed here | ||
| --> test.py:10:5 | ||
| | | ||
| 8 | @karva.tags.skip('reason here') | ||
| 9 | def test_skipped_with_reason(): | ||
| 10 | assert False | ||
| | ^^^^^^^^^^^^ | ||
| 11 | | ||
| 12 | def test_normal(): | ||
| | | ||
|
|
||
| ──────────── | ||
| Summary [TIME] 3 tests run: 1 passed, 2 failed, 0 skipped | ||
|
|
||
| ----- stderr ----- | ||
| "); | ||
| } | ||
|
|
||
| #[test] | ||
| fn runignored_with_no_skipped_tests_skips_all() { | ||
| let context = TestContext::with_file( | ||
| "test.py", | ||
| r" | ||
| def test_alpha(): | ||
| assert True | ||
|
|
||
| def test_beta(): | ||
| assert True | ||
| ", | ||
| ); | ||
| assert_cmd_snapshot!(context.command_no_parallel().arg("--run-ignored").arg("only"), @" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
| Starting 2 tests across 1 worker | ||
| SKIP [TIME] test::test_alpha | ||
| SKIP [TIME] test::test_beta | ||
|
|
||
| ──────────── | ||
| Summary [TIME] 2 tests run: 0 passed, 2 skipped | ||
|
|
||
| ----- stderr ----- | ||
| "); | ||
| } | ||
|
|
||
| #[test] | ||
| fn runignored_skipif_false_not_matched() { | ||
| let context = TestContext::with_file( | ||
| "test.py", | ||
| r" | ||
| import karva | ||
|
|
||
| @karva.tags.skip(False, reason='Condition is false') | ||
| def test_conditional(): | ||
| assert True | ||
|
|
||
| def test_normal(): | ||
| assert True | ||
| ", | ||
| ); | ||
| assert_cmd_snapshot!(context.command_no_parallel().arg("--run-ignored").arg("only"), @" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
| Starting 2 tests across 1 worker | ||
| SKIP [TIME] test::test_conditional | ||
| SKIP [TIME] test::test_normal | ||
|
|
||
| ──────────── | ||
| Summary [TIME] 2 tests run: 0 passed, 2 skipped | ||
|
|
||
| ----- stderr ----- | ||
| "); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.