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

Add missing test dependency (httpx) #9

Merged

Conversation

EtiennePelletier
Copy link
Contributor

@EtiennePelletier EtiennePelletier commented Apr 25, 2023

Following the testing instructions to run the tests from a clean environment fail at the last step due to a missing httpx dependency.

To reproduce:

$ python3 -m venv .venv
$ . .venv/bin/activate
$ pip install -e .[tests]
$ pytest

ImportError while loading conftest 'jinja2-fragments/tests/conftest.py'.
tests/conftest.py:7: in <module>
    from fastapi.testclient import TestClient
.venv/lib/python3.10/site-packages/fastapi/testclient.py:1: in <module>
    from starlette.testclient import TestClient as TestClient  # noqa
.venv/lib/python3.10/site-packages/starlette/testclient.py:16: in <module>
    import httpx
E   ModuleNotFoundError: No module named 'httpx'

Considering that FastAPI's test client directly reuses Starlette's, it's best to add Starlette's test dependencies than FastAPI's (that has a very long list).

🐍 🤹‍♂️

@sponsfreixes
Copy link
Owner

Very good assessment. Thanks!

@sponsfreixes sponsfreixes merged commit 62e8d57 into sponsfreixes:main Apr 25, 2023
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