thenewboston-blockchain / Bank

Bank for thenewboston digital currency.
https://thenewboston.com
MIT License
87 stars 42 forks source link

Fix PytestWarning: Error when trying to teardown test databases: RuntimeError("generator didn't stop after throw()") #95

Closed buckyroberts closed 3 years ago

buckyroberts commented 3 years ago
============================================ warnings summary ============================================
v1/validators/tests/validator.py::test_validator_patch
  /Users/bucky/Desktop/Projects/Bank/venv/lib/python3.7/site-packages/django/db/backends/postgresql/base.py:310: RuntimeWarning: Normally Django will use a connection to the 'postgres' database to avoid running initialization queries against the production database when it's not needed (for example, when running tests). Django was unable to create a connection to the 'postgres' database and will use the first PostgreSQL database instead.
    RuntimeWarning

v1/validators/tests/validator.py::test_validator_patch
  /Users/bucky/Desktop/Projects/Bank:0: PytestWarning: Error when trying to teardown test databases: RuntimeError("generator didn't stop after throw()")

-- Docs: https://docs.pytest.org/en/stable/warnings.html
Screen Shot 2020-11-21 at 2 19 29 PM
buckyroberts commented 3 years ago

Latest version of pytest fixes this.

idexxbernvaug commented 8 months ago

If you are a poor developer like me coming here from Google after seeing this error from your Django test suite, add this to your pytest.ini file: addopts = --reuse-db --create-db source: https://dev.to/dwmedina/my-findings-for-a-pytest-django-warning-error-when-trying-to-teardown-test-databases-48a5