Hi Russ!
I did some more testing, I found out that each test is taking an extra ~1s
to run, no matter the test size. See this TestCase for example, it
takes 4.067s to run.
from django.test import TestCase
class JobTest(TestCase):
def test_1(self):
pass
def test_2(self):
pass
def test_3(self):
pass
def test_4(self):
pass
I noticed that if I replace the django.test.TestCase with
the django.utils.unittest.TestCase the time drops to 0.009s I think that the
problem lies in the TransactionTestCase._fixture_setup method:
def _fixture_setup(self):
# If the test case has a multi_db=True flag, flush all databases.
# Otherwise, just flush default.
if getattr(self, 'multi_db', False):
databases = connections
else:
databases = [DEFAULT_DB_ALIAS]
for db in databases:
call_command('flush', verbosity=0, interactive=False,
database=db)
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,
'database': db})
The flush is what takes ~1s to run, If I comment that line the time drops to
almost zero seconds.
Does this makes any sense? Did the Django 1.3 changed this behavior?
I am downloading the Django 1.2.5 source to do more investigation.
Best regards,
Cesar Canassa
2011/6/21 Russell Keith-Magee <[email protected]>
> On Wed, Jun 22, 2011 at 1:31 AM, Cesar Canassa <[email protected]>
> wrote:
> > I am working in a large Django project that is currently using the 1.2.3
> > version. The project test suite has around 500 test which take ~50
> seconds
> > to run in my machine.
> > I recently did a upgrade to the Django 1.3 version, the upgrade was
> smooth
> > so far, most problems came from the SQL Server driver but these are not
> used
> > in the test suite, since the test database is SQLite. The only thing I
> had
> > to change in the project itself was removing the jogging app since the
> 1.3
> > has built-in logging facilities.
> > The problem is that the test suite now takes ~500 seconds to run, that's
> > about 10 times longer than it did with the 1.2.3 version.
> > Has anyone had a similar issue? I have a felling that this related to
> > running Django under Windows.
>
> I can't say I've heard any such reports -- if anything, 1.3 testing
> should be faster, due to a number of optimizations in the test startup
> process.
>
> If you identify the source of the slowdown, I'd be interested in
> hearing about it in case it is a serious regression on Django's part.
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.