Skip to main content

inline-tests

Rust-like inline tests for Python. Write and run tests right next to your code!

Haven't tested this on large projects, but it provides the amazing feature of rust which is a single file with its tests

Surprised this didn't exist prior

No async, no fixtures, no fancy stuff

Installation

pip install inline-tests

Usage

In your Python files:

from inline_tests.decorators import test, before_each, after_each

def add(a: int, b: int) -> int:
    return a + b

@test
def test_add():
    assert add(2, 2) == 4

@test(tag="math")
def test_add_negative():
    assert add(-2, -2) == -4

Run tests:

# Run all tests in project
run-tests

# Run specific files
run-tests file1.py file2.py

# Run tests with specific tag
run-tests --tag math

# Run tests in specific directory
run-tests --path /path/to/project

Metadata

Release files for inline_test 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inline_test 0.1.1
File Size Uploaded
inline_test-0.1.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inline_test 0.1.1
File Interpreter ABI Platform
inline_test-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / inline_test-0.1.1.tar.gz

Download URL inline_test-0.1.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
28a6ecfc315c58b3c86948aa75b2aaf6b24e549e7650c6fb57426606cc3e8676
BLAKE2b-256 checksum
How to use checksums
e6e3df8e1775fabfa225b357ee63b4d5affd3ed973ac6731fd5494d505fcfa6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.14

Release files / inline_test-0.1.1-py3-none-any.whl

Download URL inline_test-0.1.1-py3-none-any.whl
Size 2.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c9fc20582d06b6fbe35f41a11ad1efa5c138e018e672feb8c27c254159bef4a
BLAKE2b-256 checksum
How to use checksums
32dee79d606a145824cdbe1454360e388b705b6280faf00bf8ea9077e37838dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.14

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page