Skip to main content

rust-style test macro

Project description

inline-tests

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

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 current directory
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

Project details


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.0.tar.gz (3.7 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.0-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for inline_test-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f65fa1e01ce5f3f38cfcf8c412bd3f9c2525e16041ce17e08f0f757732fd56f0
MD5 90ea5144f7c744c2a6bd12037c4eec99
BLAKE2b-256 586d1e950b6b386e37d309c494a52073e677029b6146a8b87eef8a7a1ebbf234

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for inline_test-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7f47a053c21dd42be31a5a6778978526b9d6aeee20475cf65c82526b135075aa
MD5 cfd9caf858ede3ee8c5bd866360cdd4c
BLAKE2b-256 081259b42e0547d90a62844e24b531bcf4eabc776b8a311a73e9a1c271f3e8e2

See more details on using hashes here.

Supported by

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