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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| transtests-0.0.2.tar.gz | 4.7 kB | With provenance | Details for transtests-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| transtests-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for transtests-0.0.2-py3-none-any.whl |
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 logRelease 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 logSecurity for transtests 0.0.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for transtests-0.0.2.tar.gz
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 logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.