Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants