Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Strict type-checking of tests using the default argument syntax #310

Open
hukkin opened this issue Dec 16, 2021 · 1 comment
Open

Strict type-checking of tests using the default argument syntax #310

hukkin opened this issue Dec 16, 2021 · 1 comment

Comments

@hukkin
Copy link
Contributor

hukkin commented Dec 16, 2021

Do you have plans for allowing strict type-checking of tests using the default argument syntax? The issue I see here is that the parameter should be annotated with the type of the value injected into the test, but the default argument has the type of the fixture that provides the value. It seems analogous to how dataclasses.field works, and would probably require a mypy plugin as well?

Originally posted by @cjolowicz in #268 (comment)

@janbuchar
Copy link

It may be possible to leverage typing.Annotated here - FastAPI recently started doing this for a similar pattern - https://github.com/tiangolo/fastapi/releases/tag/0.95.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants