Skip to main content
ⓘ

Downloads Downloads Coverage Status Lines of code Hits-of-Code Test-Package Python versions PyPI version Checked with mypy Ruff DeepWiki

logo

If your code needs to work the same way with regular, asynchronous, and generator functions, you normally have to write three sets of nearly identical tests. With this library, you no longer need to do that — just use the special pytest fixture, which automatically generates the variants.

Usage

To use the fixture, install it via:

pip install transtests

The transformed fixture is now available. It returns a decorator that transforms the original function into one of three variants: a synchronous function, an asynchronous function, or a generator function:

from asyncio import run
from inspect import iscoroutinefunction, isgeneratorfunction

def test_something(transformed):
    @transformed
    def some_function(a, b):
        return a + b
    
    if iscoroutinefunction(some_function):
        assert run(some_function(1, 2)) == 3

    elif isgeneratorfunction(some_function):
        assert list(some_function(1, 2)) == [3]

    else:
        assert some_function(1, 2) == 3

↑ The test will be run three times automatically, once per variant.

This functionality is based on the transfunctions library, so you can use context managers from that library in the source function.

Metadata

Release files for transtests 0.0.2

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

Source distribution (sdist)

Source distribution for transtests 0.0.2
File Size Uploaded
transtests-0.0.2.tar.gz 4.7 kB Details

Built distribution (wheel)

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

Total release size: 9.6 kB

Release files / transtests-0.0.2.tar.gz

Download URL transtests-0.0.2.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f2cd6c20f3a6aafcacb7ebd4475352f1ad3453ebdc8d40c65a4dcb323379decc
BLAKE2b-256 checksum
How to use checksums
e9253e29990ab8bff589b05f6f27c2c18abb8aa0295a4b48a6508a1a7f629a75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Release files / transtests-0.0.2-py3-none-any.whl

Download URL transtests-0.0.2-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47656ce9aedd40cce8398b4a39c2c0e3ce3dd157fb39e006fd758d971e56997f
BLAKE2b-256 checksum
How to use checksums
7ba6777b14626033cc4bcfd67f4f7d8a082198c2f16d00548fa556e5674bffcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

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