I looked at this again this morning and it appears that unit tests
within a test class do run in alphabetical order after all. This is
handled by the sortTestMethodsUsing property of the TestLoader class
of the unittest lib itself. Maybe this has changed in a newer version,
but in mine (2.4.4) this is the case.

To provide a solution to my own problem: it's possible to catch the
KeyboardInterrupt exception by overriding the 'run' method of the
TestCase class. Seeing as it might be useful to some, I've made a tiny
snippet out of it:

http://www.djangosnippets.org/snippets/247/

regards,
Simon



On May 18, 12:55 pm, simonbun <[EMAIL PROTECTED]> wrote:
> Ah, should have refreshed before replying...I had placed a test_a,
> test_z, test_zz in a particulartestclass and they ran
> alphabetically, but that was probably a coincidence apparently.
>
> Too bad this can't be done (yet). Thanks for the info anyway.
>
> regards,
> Simon
>
> On May 18, 12:49 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
>
> > On 5/18/07, simonbun <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I have unit tests for a particular app that take about 2 minutes to
> > > complete. Needless to say, adding new unit tests to this app and
> > > running them is a time consuming process. I know that the old unit
> > > tests will succeed and am basically only interested in the results for
> > > the new unittest.
>
> > > As far as I can tell, unit tests get run in reversed order (newer
> > > first).
>
> > Incorrect. They run in dictionary order (which is to say, effectively
> > random order) within any giventestclass.Testclasses for an
> > application are run in the the order they are defined in models.py,
> > followed by any tests defined in tests.py. Each application is tested
> > in the order listed in INSTALLED_APPS.
>
> > > Is there a way to achieve what I want?
>
> > Not at the moment. I've been meaning to revisit thetestrunnerto add
> > the ability to run a specifictestcase ortestclass by name, but I
> > haven't had a chance to work on this yet.
>
> > 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 django-users@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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to