Skip to content

Configuration

src

include

A list of files and directories to check. Including a file or directory will make it so that it (and its contents) are tested.

  • tests matches a directory named tests
  • tests/test.py matches a file named test.py in the tests directory

Default value: null

Type: list[str]

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.src]
include = ["tests"]

respect-ignore-files

Whether to automatically exclude files that are ignored by .ignore, .gitignore, .git/info/exclude, and global gitignore files. Enabled by default.

Default value: true

Type: bool

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.src]
respect-ignore-files = false

terminal

output-format

The format to use for printing diagnostic messages.

Defaults to full.

Default value: full

Type: full | concise

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.terminal]
output-format = "concise"

show-python-output

Whether to show the python output.

This is the output the print goes to etc.

Default value: true

Type: true | false

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.terminal]
show-python-output = false

test

fail-fast

Whether to fail fast when a test fails.

Defaults to false.

Default value: false

Type: true | false

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.test]
fail-fast = true

retry

When set, we will retry failed tests up to this number of times.

Default value: 0

Type: u32

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.test]
retry = 3

test-function-prefix

The prefix to use for test functions.

Defaults to test.

Default value: test

Type: string

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.test]
test-function-prefix = "test"

try-import-fixtures

When set, we will try to import functions in each test file as well as parsing the ast to find them.

This is often slower, so it is not recommended for most projects.

Default value: false

Type: true | false

Example usage (pyproject.toml):

TOML
1
2
[tool.karva.test]
try-import-fixtures = true