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

fix async_generator error by making the app fixture async #336

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

john0isaac
Copy link

@john0isaac john0isaac commented Apr 26, 2024

The app fixture is not created as an async fixture which results in breaking the second part of the documentation where we attempt to access the test_client() it gives an async_generator.
This PR fixes that to pass the tests

AttributeError: 'async_generator' object has no attribute 'test_client'

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

We are yielding the app fixture but not passing it as an argument which seems to break the second part of the documentation where we attempt to access the `test_client()` it gives an async_generator.

```bash
AttributeError: 'async_generator' object has no attribute 'test_client'
```
@john0isaac john0isaac changed the title fix async_generator error by passing the fixture name as an argument fix async_generator error by making the app fixture async Apr 27, 2024
@pgjones
Copy link
Member

pgjones commented May 19, 2024

Does this depend on the pytest-asyncio mode you are using? As it works for me without this change here

@john0isaac
Copy link
Author

john0isaac commented May 19, 2024

@pgjones I'm using the default values for everything.

I will reproduce and get back to you with the detailed versions of everything in an isolated environment.

This is my working setup here.

Have you tested this recently? Maybe it changed in the latest versions but was working previously..

My change works on Python 3.10, 3.11, 3.12

but I will reproduce again and leave detailed comment with it.

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.

[Docs] AttributeError: 'async_generator' object has no attribute 'test_client'
2 participants