-
Notifications
You must be signed in to change notification settings - Fork 341
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
Database connection issue #1066
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using
pytest-django
andpytest-docker
; pretty sure my issue is withpytest-django
but wanted to mention that.Any tests I run that enable a database connection using the
db
fixture or@pytest.mark.django_db
mark error withdjango.db.utils.OperationalError: connection is bad: nodename nor servname provided, or not known
. I can run the test container fine, and a basic fixture I am using to wait to run tests until the application is running also works. I am running my migrations in an entrypoint script; I can see from Docker Desktop logs that they are running correctly. The entrypoint also ensures that the Django container waits for Postgres to be available before trying to run the migrations or server. I can see thathttp_service
fixture which waits for Django to be available before running tests is succeeding, so Django itself seems to be running correctly (returns a 200 when visiting the root of the site and a 404 for a non-existent URL). But any tests which usepytest.mark.django_db
error out. I'm not finding much for thisconnection is bad
error; theRuntimeWarning
is confusing, as the container runs fine and I canexec
in and run the exact same commands as my test without issue.The text was updated successfully, but these errors were encountered: