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.2.0.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.2.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intest-0.2.0.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.2.0.tar.gz
Algorithm Hash digest
SHA256 b52ba30eadaf3d204c06ee9c5e3cb9235661686115b6cd0771a3f3ca58fb5842
MD5 d170f031c80a0d6b1cb87b281d03e5a1
BLAKE2b-256 a397f635c902b0b3079a28fa54145b7f178e4fe019150f94988b76b3f062937c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for intest-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ae3251c72d05b019127710dd3bd1d61164ef8eeac87c4dc8c9c75c613add1d8
MD5 b2c554c42e2a2e0e3d861c0a3e0025ce
BLAKE2b-256 e5b59054d917e9c7b9149ca71f7c4aac3eb367e8125d6d69fd748fb725aaa32c

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