I am using Django 1.8 and the docs say to use --keepdb
to save the test database.
I am doing that and the database is there but every time I see it, it is empty and has no data in it.
Is there any way that I can preserve that so that I can see what's in there?
All of your code is running within database transactions, which get rolled back at the end of each test.
From the Django testing docs:
This "isolation" means that anything you do inside of the test will be rolled back before the next test starts.
Instead, you want to use Python's class
unittest.TestCase
.Another quote from the Django docs:
As long as you can guarantee that your tests won't clobber each other's data, you can safely use this class instead of Django's test case.