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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inline_test-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inline_test-0.1.1-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file inline_test-0.1.1.tar.gz.

File metadata

  • Download URL: inline_test-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.14

File hashes

Hashes for inline_test-0.1.1.tar.gz
Algorithm Hash digest
SHA256 28a6ecfc315c58b3c86948aa75b2aaf6b24e549e7650c6fb57426606cc3e8676
MD5 1b1b68b5976219a67779d890edfcba95
BLAKE2b-256 e6e3df8e1775fabfa225b357ee63b4d5affd3ed973ac6731fd5494d505fcfa6d

See more details on using hashes here.

File details

Details for the file inline_test-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for inline_test-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c9fc20582d06b6fbe35f41a11ad1efa5c138e018e672feb8c27c254159bef4a
MD5 95bb26b14ab00e0d36ede8e6e79f5219
BLAKE2b-256 32dee79d606a145824cdbe1454360e388b705b6280faf00bf8ea9077e37838dc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page