Wednesday, August 27, 2014

Re: How quickly do Django unit tests run?...

Postgres. best of luck.


On Thu, Aug 28, 2014 at 4:16 AM, Fred Stluka <fred@bristle.com> wrote:
Ben,

Thanks!  That's exactly the kind of ballpark figure I wanted.

Sounds like I should be expecting roughly 5-10 tests/sec, plus
maybe 10-20 secs DB setup/migration.  I'm currently seeing 1
test per 7-9 secs, plus 50-60 secs DB setup time (syncdb, not
South, since I'm setting SOUTH_TESTS_MIGRATE = False).

Yeah, something must be wrong here.  I'm running 100X slower
than expected.

BTW, are those numbers using SQLite, MySQL, PostgreSQL, other?
So far, I'm using MySQL, running locally on a pretty fast Mac laptop.
I'm planning to switch to SQLite for testing, to make it run faster,
but haven't gotten that to work yet.

My next steps will be try again with SQLite, and perhaps get the
test suite to run in the PyCharm debugger so I can step through
the code and see where all the time is going.

Thanks again!

--Fred
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
On 8/27/14 4:21 PM, Benjamin Scherrey wrote:
Clearly that depends on what your tests do. One of our projects runs ~400 tests in about a minute. If your tests do much database access or have complex setUp/tearDown then that's not going to be as fast of course. The Django 1.7 project I'm working on at the moment takes a total of 12.7 seconds to complete but most of that time is the setup and migrations execution for the test db. Once it starts the 36 tests I have now complete in 3.58 seconds in verbose mode with full branch coverage turned on. 

coverage run --branch --source="partner,item,utils,importing,channel" manage.py test --verbosity=2 && coverage report --show-missing

-- Ben


On Thu, Aug 28, 2014 at 3:13 AM, Fred Stluka <fred@bristle.com> wrote:
Benjamin,

OK, Thanks!  So roughly how fast would you expect?  Hundreds
of trivial tests per minute?  Thousands per minute?

Thanks!
--Fred
Fred Stluka -- mailto:fred@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
On 8/27/14 3:57 PM, Benjamin Scherrey wrote:
Something's definitely wrong. Except for the initial setup for the test run (in 1.7 migrations run each time for example), the individual tests should execute as fast as any normal python unit test.


On Wed, Aug 27, 2014 at 9:06 PM, Fred Stluka <fred@bristle.com> wrote:
How quickly do Django unit tests run?

Mine are taking 7-9 seconds each, even for trivial tests like:
        self.assertEqual(1 + 1, 2)
that are all in the same test class of the same app.

Is this typical?  Or do I have something misconfigured.

Thanks!
--Fred

--
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+unsubscribe@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/53FDE5E7.6040506%40bristle.com.
For more options, visit https://groups.google.com/d/optout.



--
Chief Systems Architect Proteus Technologies
Personal blog where I am not your demographic.

This email intended solely for those who have received it. If you have received this email by accident - well lucky you!!
--
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+unsubscribe@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/CAHN%3D9D4DNokh2VG47JE9m39FWuR%2Bcc%3D-inUL%3DeRJEr18YHnFRQ%40mail.gmail.com.

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+unsubscribe@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/53FE3BDE.8020305%40bristle.com.

For more options, visit https://groups.google.com/d/optout.



--
Chief Systems Architect Proteus Technologies
Personal blog where I am not your demographic.

This email intended solely for those who have received it. If you have received this email by accident - well lucky you!!
--
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+unsubscribe@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/CAHN%3D9D5vXm4N7Rn4hr_BR4hFqviuw5ve6OEY1ty5t0fxcyD1rg%40mail.gmail.com.

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+unsubscribe@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/53FE4ABD.4020500%40bristle.com.

For more options, visit https://groups.google.com/d/optout.



--
Chief Systems Architect Proteus Technologies
Personal blog where I am not your demographic.

This email intended solely for those who have received it. If you have received this email by accident - well lucky you!!

--
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+unsubscribe@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/CAHN%3D9D496C_98XwuOfZfVaHCs9AQg7J9XgeDCDyOxmGz1y2Anw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment