You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to re-use existing DB when running tests, getting following errors:
nosetests order.tests.adminviews.test_tpl_reports:TestTPLReport REUSE_DB=1 --verbosity=1 Creating test database for alias 'default'... Got an error creating the test database: (1007, "Can't create database 'test_test_bigbasket'; database exists") Type 'yes' if you would like to try deleting the test database 'test_test_bigbasket', or 'no' to cancel: no Tests cancelled.
When I say no the tests are cancelled, it's not re-using the existing DB.
You have to say "yes". It will then delete it, then recreate it, then delete it when it finishes the tests.
Then run another test. It will create it, but it won't delete it.
Now you can run tests with --keepdb and it will keep reusing that same one without deleting it.
REUSE_DB=1 ./manage.py test --keepdb
If you have to delete it (migrations won't run, you switched to an incompatible feature branch etc.) then omit --keepdb and it will offer to delete the old one.
This is what I use on my mac for running tests in docker:
# ~/.bash_profile
quickTest () {
docker-compose run --rm -e REUSE_DB=1 -e TESTING=True web python ./manage.py test --keepdb --parallel -v 2 "$@"
}
alias qt=quickTest
I am unable to re-use existing DB when running tests, getting following errors:
nosetests order.tests.adminviews.test_tpl_reports:TestTPLReport REUSE_DB=1 --verbosity=1 Creating test database for alias 'default'... Got an error creating the test database: (1007, "Can't create database 'test_test_bigbasket'; database exists") Type 'yes' if you would like to try deleting the test database 'test_test_bigbasket', or 'no' to cancel: no Tests cancelled.
When I say
no
the tests are cancelled, it's not re-using the existing DB.Our project is very large and here's it: https://pastebin.com/pSZwm9rB
The text was updated successfully, but these errors were encountered: