Skip
The skip tag allows us to mark test functions to be skipped during test execution.
When a test is skipped, it will not be run but will be counted in the test results.
Basic Usage
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.
Reason
You can provide a str reason as a positional or keyword argument.
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.
Pytest
You can also still use @pytest.mark.skip.
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.
Conditions
We can provide bool conditions as a positional arguments.
Then the test will only be skipped if all conditions are True.
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.
You can still provide a reason as a keyword argument.
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.
Multiple Conditions
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one failed test.
Pytest
You can also still use @pytest.mark.skipif.
| test.py | |
|---|---|
1 2 3 4 5 | |
Then running uv run karva test will result in one skipped test.