Did you see some documentation that said that the test framework will clear the database?
I'm not sure that it's reasonable to ask a test framework to do that, given the number of possible databases and interface layers, though it is conceivable that django's variation on test could take care of this for the ORM. Still, explicit is better than implicit. A common way to clean up, by the way, is to start a transaction in setUp() and do a rollback in tearDown(). On Wed, Dec 2, 2015 at 11:21 AM, Siddhi Divekar <siddhesh.dive...@gmail.com> wrote: > Hi Ke1g, > That is the last option but > wanted to understand why database was not cleaned after first test. > > On Wednesday, December 2, 2015 at 7:56:26 AM UTC-8, ke1g wrote: >> >> Make test b clean up after itself, by deleting the test object. >> >> On Wed, Dec 2, 2015 at 9:28 AM, Tim Graham <timog...@gmail.com> wrote: >> >>> It will be easier to help if you can provide a sample project that >>> reproduces the error. >>> >>> On Wednesday, December 2, 2015 at 3:01:31 AM UTC-5, Siddhi Divekar wrote: >>>> >>>> Hi, >>>> >>>> Am seeing that test case in suite are failing but passing when ran >>>> individually. >>>> I have gone through most of the thread on the internet but did not find >>>> any solution. >>>> >>>> Below is the snip of what am trying to do. >>>> >>>> class A(TestCase): >>>> def test_a(): >>>> create an obj in db >>>> retrive obj list from db and check the length of the list (should be >>>> 1) >>>> update same obj in db >>>> delte same obj in db >>>> >>>> def b(): >>>> create an obj in db and check the length. >>>> >>>> When ran in suite test_a fails as the length of the list is 2. >>>> test_b() runs before test_a and leave the object in the database. >>>> >>>> From various threads suggested using 'django.test import TestCase' >>>> instead of 'from django.unittest import TestCase' which am already >>>> doing. >>>> >>>> Is there anything else i need to do here ? >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users...@googlegroups.com. >>> To post to this group, send email to django...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/f8ad70a1-4abf-406b-8668-a6d860a868bb%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/f8ad70a1-4abf-406b-8668-a6d860a868bb%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/fd9cfc5e-5c1c-450f-a91a-5cce46a9f6fd%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/fd9cfc5e-5c1c-450f-a91a-5cce46a9f6fd%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAB%2BAj0v_MQMDKBoJ9W3%2B-CX2efsObUyg0t_tBKYjeaGmDx%3D%3DOQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.