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

Fixture for Async Client #864

ResleyR opened this issue Aug 25, 2020 · 1 comment

Fixture for Async Client #864

ResleyR opened this issue Aug 25, 2020 · 1 comment


Copy link

@ResleyR ResleyR commented Aug 25, 2020

With Django 3.1 it would be useful to have an async_client fixture similar to the existing client fixture.
The following code works but would be nice if it was part the plugin itself

def async_client():
    """A Django async test client instance."""

    if get_django_version() < (3, 1):
        pytest.skip("no Django settings")
    from django.test.client import AsyncClient

    return AsyncClient()

This allows for testing async views when used along with pytest-asyncio with the alternative being using the django TestCase instead.

Copy link

@bluetech bluetech commented Oct 18, 2020

Fixed in #865, will be in 4.1 (along with async_rf).

The fixture as written doesn't do the automatic pytest.skip on django<3.1. Personally not sure automatic skip is a good idea...


@bluetech bluetech closed this Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants