18👍
✅
python manage.py test -k
In Django 1.8, you can use -k command.
New in Django 1.8: You can prevent the test databases from being
destroyed by adding the –keepdb flag to the test command. This will
preserve the test database between runs. If the database does not
exist, it will first be created. Any migrations will also be applied
in order to keep it up to date.
You can read this for more details:
https://docs.djangoproject.com/en/1.8/topics/testing/overview/#the-test-database
8👍
Well, it’s just a comment, not an answer yet – so I’ll repeat the comment of Rahul Gupta:
Just subclass from SimpleTestCase
instead of TestCase
, see Django Testing Tools Documentation.
👤OBu
- How to make sure Django models match the database schema
- Django: why are Django model fields class attributes?
- Get only certain fields of related object in Django
Source:stackexchange.com