Skip to main content

rust-style test macros

Project description

intest

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 intest

Usage

In your Python files:

from intest.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
intest

# Run specific files
intest file1.py file2.py

# Run tests with specific tag
intest --tag math

# Run tests in specific directory
intest --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

intest-0.1.3.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

intest-0.1.3-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file intest-0.1.3.tar.gz.

File metadata

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

File hashes

Hashes for intest-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3e598f6f1d2b4a5ac2e3d9811e28ab5b3e0f288b03fe6c925d3e3569d2f7faab
MD5 53e5f17c1f5cbf7356181531f3d1ceff
BLAKE2b-256 6cb3cbd36154dea5233bb5d58d06d05175ada6cbdcda8a097af47ac981f6f4e9

See more details on using hashes here.

File details

Details for the file intest-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: intest-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.14

File hashes

Hashes for intest-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 82354ef28a10ad2170492c2ee630c018b18fbe2c2da668b7448ac7d7eba2d984
MD5 57c4277424490f0c37370f608b92977f
BLAKE2b-256 3dfe7e44b66f5a861b3325109d6f6cde856062ad61d35b65cfd3fee2d6387572

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