You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

karva

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karva

A Python test framework, written in Rust.

0.1.4
pipPyPI
Maintainers
1

Karva (0.1.4)

A Python test framework, written in Rust.

Benchmark results

About Karva

Karva aims to be an efficient alternative to pytest and unittest.

While we do not yet support all of pytest's features, we aim to gradually add support for pytest alternatives as we add features.

Getting started

Installation

Karva is available as karva on PyPI.

Use karva directly with uvx:

uvx karva test
uvx karva version

Or install karva with uv, or pip:

# With uv.
uv tool install karva@latest

# Add karva to your project.
uv add --dev karva

# With pip.
pip install karva

Usage

By default, Karva will respect your .gitignore files when discovering tests in specified directories.

To run your tests, try any of the following:

# Run all tests.
karva test

# Run tests in a specific directory.
karva test tests/

# Run tests in a specific file.
karva test tests/test_example.py

Example

Here is a small example usage

tests/test.py

def test_pass():
    assert True


def test_fail():
    assert False, "This test should fail"


def test_error():
    raise ValueError("This is an error")

Running karva:

uv run karva test tests/test.py

Provides the following output:

fail[assertion-failed]
 --> test_fail at tests/test.py:5
 | File "tests/test.py", line 6, in test_fail
 |   assert False, "This test should fail"

error[value-error]
 --> test_error at tests/test.py:9
 | File "tests/test.py", line 10, in test_error
 |   raise ValueError("This is an error")

Passed tests: 1
Failed tests: 1
Errored tests: 1

Contributing

Contributions are welcome! See CONTRIBUTING.md for more information.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts