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

Test failure due to httpx change in 0.28 #335

Open
mjpieters opened this issue Jan 8, 2025 · 0 comments · May be fixed by #336
Open

Test failure due to httpx change in 0.28 #335

mjpieters opened this issue Jan 8, 2025 · 0 comments · May be fixed by #336

Comments

@mjpieters
Copy link

In version 0.27, httpx deprecated the app keyword argument:

Deprecated

  • The app=... shortcut has been deprecated. Use the explicit style of transport=httpx.WSGITransport() or transport=httpx.ASGITransport() instead.

and in version 0.28, the deprecated keyword was removed:

The following changes are also included:

...

  • The deprecated app argument has now been removed.

The ariadne-codegen tests use this keyword argument in the main.test_generated_client::http_client fixture:

@pytest.fixture
def http_client():
return AsyncClient(base_url="http://127.0.0.1:8000", app=api_app)

Luckily, the fix is fairly simple and works across all httpx versions that ariadne-codegen can be used with (0.23 and up); create a ASGITransport() instance and pass that in as the transport keyword argument:

@pytest.fixture
def http_client():
    transport = ASGITransport(app=api_app)
    return AsyncClient(base_url="http://127.0.0.1:8000", transport=transport)
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