I have a question abut database flush condition.
in django/test/testcases.py TestCase._pre_setup()

forrow is _pre_setup() comment
"""
...
If the Test Case class has a 'fixtures' member, clearing the
database and installing the named fixtures at the start of each
test.
...
"""

Comment of this method looks like this "if class doesn't have a
'fixtures' member, doesn't clear the database.".

But in actually, the database is cleared every time if class does not
have a 'fixtures' member ,too.

I usually uses python unittest.TestCase without 'fixtures' member for
my test and database is generate at only first time.
So I'll change to django.test.TestCase that causes problem.
Flushing the database and does not load anything every time that I
don't expected.

I want to know why "flush" is not implemented in if-block.

like this

Index: django/test/testcases.py
===================================================================
*** django/test/testcases.py    (revision 6709)
--- django/test/testcases.py    (working copy)
***************
*** 56,65 ****
                test.
              * Clearing the mail test outbox.
          """
-         call_command('flush', verbosity=0, interactive=False)
          if hasattr(self, 'fixtures'):
              # We have to use this slightly awkward syntax due to the
fact
              # that we're using *args and **kwargs together.
              call_command('loaddata', *self.fixtures, **{'verbosity':
0})
          mail.outbox = []

--- 56,65 ----
                test.
              * Clearing the mail test outbox.
          """
          if hasattr(self, 'fixtures'):
              # We have to use this slightly awkward syntax due to the
fact
              # that we're using *args and **kwargs together.
+             call_command('flush', verbosity=0, interactive=False)
              call_command('loaddata', *self.fixtures, **{'verbosity':
0})
          mail.outbox = []



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to