Pytest Annotated
A Pytest plugin to allow the use of Annotated to resolve fixtures, allowing test arguments to have different names to the fixture itself.
Usage:
Simple:
from typing import Annotated
from pytest_annotated import Fixture
class SomeThing:
pass
@pytest.fixture
async def somefixture(someotherfixture) -> SomeThing:
return SomeThing()
async def test_thing(st: Annotated[SomeThing, Fixture(somefixture)]):
assert isinstance(st, SomeThing)
Aliased:
from typing import Annotated
from pytest_annotated import Fixture
class SomeThing:
pass
@pytest.fixture
async def somefixture(someotherfixture) -> SomeThing:
return SomeThing()
SomethingFixture = Annotated[SomeThing, Fixture(somefixture)]
async def test_thing(st: SomethingFixture):
assert isinstance(st, SomeThing)
Registered Type:
Uses @pytest_annotated.fixture instead of @pytest.fixture to register the annotated return type of a fixture to always be resolved using that fixture.
from typing import Annotated
import pytest_annotated
from pytest_annotated import Fixture
class SomeThing:
pass
@pytest_annotated.fixture
async def somefixture(someotherfixture) -> SomeThing:
return SomeThing()
async def test_thing(st: SomeThing):
assert isinstance(st, SomeThing)
TODO:
- Support
Annotatedfunction arguments in fixtures as well. - Figure out if there's a way to do this without using so many
_privateparts of pytest!
Metadata
Release files for pytest-annotated 0.1.1
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 |
|---|---|---|---|---|
| pytest_annotated-0.1.1.tar.gz | 5.1 kB | Without provenance | Details for pytest_annotated-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_annotated-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pytest_annotated-0.1.1-py3-none-any.whl |
Total release size: 10.1 kB
Release files / pytest_annotated-0.1.1.tar.gz
| Download URL | pytest_annotated-0.1.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8f9e5d249fbfbec1ca025ec943665fc76e130706644263e0e5338971e65ccbe
|
|
BLAKE2b-256 checksum How to use checksums |
dd786ac3c24cff0bb8c1c2d843d13728bf8363b8580682b75f01604684ddfecc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.17
|
Release files / pytest_annotated-0.1.1-py3-none-any.whl
| Download URL | pytest_annotated-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb063f232c14354f621e46bca825e6a9f51cd0da6d35a52c4c3fd1ea21b4d750
|
|
BLAKE2b-256 checksum How to use checksums |
df79405867c86540babc260836a46e59b394b7a5b4dfdefeb3287fa02607c8ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.4.17
|
Security for pytest-annotated 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.