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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imcomplete typing at @given decorator for async #3099

Closed
humrochagf opened this issue Sep 15, 2021 · 0 comments 路 Fixed by #3100
Closed

Imcomplete typing at @given decorator for async #3099

humrochagf opened this issue Sep 15, 2021 · 0 comments 路 Fixed by #3100

Comments

@humrochagf
Copy link
Contributor

Hello!

First I would like to thank you all for this awesome project 馃檪

I'm using it with pytest to run some async tests and I noticed that type annotation seems incomplete for async tests.

I wrote a quick example to demonstrate the case, the dependencies needed to run it are:

pip install mypy pytest pytest-asyncio hypothesis

Then created a tests.py with the following content:

import pytest
from hypothesis import given
from hypothesis import strategies as st


@given(st.integers())
@pytest.mark.asyncio
async def test_hypotesis(x: int) -> None:
    assert isinstance(x, int)

If you run mypy . you get the following:

tests.py:6: error: Argument 1 has incompatible type "Callable[[int], Coroutine[Any, Any, None]]"; expected "Callable[..., None]"
Found 1 error in 1 file (checked 1 source file)

Checking the decorator it seems to cover Callable cases but not the ones that uses Coroutines.

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

Successfully merging a pull request may close this issue.

1 participant