Skip to content

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
import karva

@karva.tags.skip
def test_function():
    assert False

Then running uv run karva test will result in one skipped test.

test.py
1
2
3
4
5
import karva

@karva.tags.skip()
def test_function():
    assert False

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
import karva

@karva.tags.skip("This test is not implemented yet")
def test_function():
    assert False

Then running uv run karva test will result in one skipped test.

test.py
1
2
3
4
5
import karva

@karva.tags.skip(reason="Waiting for feature X to be implemented")
def test_function():
    assert False

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
import pytest

@pytest.mark.skip(reason="Waiting for feature X to be implemented")
def test_function():
    assert False

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
import karva

@karva.tags.skip(True)
def test_function():
    assert False

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
import karva

@karva.tags.skip(True, reason="Waiting for feature X to be implemented")
def test_function():
    assert False

Then running uv run karva test will result in one skipped test.

Multiple Conditions

test.py
1
2
3
4
5
import karva

@karva.tags.skip(True, False) # This will not be skipped
def test_function():
    assert False

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
import pytest

@pytest.mark.skipif(True, reason="Waiting for feature X to be implemented")
def test_function():
    assert False

Then running uv run karva test will result in one skipped test.