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

Update testing.md with fixed code for pytest blacksheep testing #29

Merged
merged 1 commit into from
Nov 19, 2023

Conversation

sinnwise
Copy link
Contributor

@sinnwise sinnwise commented Jun 19, 2023

This problem seems to come across with 3.11, don't exactly know the circumstances in why/which this error gets reported.

test_test.py::test_create_and_get_todo FAILED                            [100%]
test_test.py:4 (test_create_and_get_todo)
test_client = <coroutine object test_client at 0x108f84520>

    @pytest.mark.asyncio
    async def test_create_and_get_todo(test_client: TestClient) -> None:
>       response = await test_client.get("/")
E       AttributeError: 'coroutine' object has no attribute 'get'

test_test.py:7: AttributeError

But with pytest_asyncio.fixture used instead of pytest.fixture it seems to work.

Edit:

[Example Repo](https://github.com/sinnwise/test_blacksheep_pytest

This problem seems to come across with 3.11, don't exactly know the circumstances in why/which this error gets reported. 

```
test_test.py::test_create_and_get_todo FAILED                            [100%]
test_test.py:4 (test_create_and_get_todo)
test_client = <coroutine object test_client at 0x108f84520>

    @pytest.mark.asyncio
    async def test_create_and_get_todo(test_client: TestClient) -> None:
>       response = await test_client.get("/")
E       AttributeError: 'coroutine' object has no attribute 'get'

test_test.py:7: AttributeError
```
@RobertoPrevato
Copy link
Member

Hi @sinnwise
Sorry for replying so late. Thank You for your contribution, I merge it now and publish and update to the docs site later today.

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 this pull request may close these issues.

2 participants