I was having some trouble running tests for my app and I managed to solved them in this previous post.
Now executing python manage.py test
does go through without raising any errors, but it gets stuck at database creation:
When the test database doesn't exist it does create as I can see in pgAdmin, but it gets stuck in the process with this message:
Creating test database for alias 'default'...
It is stuck here forever, so when I finish the process manually and run test
again, it says the database exists and prompts me to either delete it and create anew, or cancel the process. I type 'yes' and the process is stuck again with this other message:
Destroying old test database 'default'...
With pgAdmin open I can't immediately see any new test_dbname
database, but if I close and open it again I can, there test_dbname
is, but the test
task is just stuck there and doesn't go through...
A workaround to this problem is this solution, disabling migrations. This way it no longer gets stuck at those messages and the default test is run.
.
----------------------------------------------------------------------
Ran 1 test in 0.002s
OK
However, this just seems to be a bad solution and cheating. There must be a good reason migrations are run when running tests so I don't see a good reason to disable them.