问题
i'm writing tests for my django app, and i can't understand when does the
database is destroyed..
in django website it says its being destroy "he test databases are destroyed when all the tests have been executed."
i understand from that, that the db is destroyed when the last test command in
the last test*.py file is executed.
so i wrote some tests and i have the following:
UserMethodsTests(TestCase):
def test_get_full_name(self):
create db objects in model X
do some stuff on them (not deleting)
def test_get_username(self):
* empty line
create more db objects in model X
but if i write "print len(X.objects.all())" in * empty line,
it output 0, as if the db was deleted..
so i don't understand if when does the db destroy/deleted
can someone help me?
来源:https://stackoverflow.com/questions/30232963/when-does-the-database-is-being-destroy-in-django-tests