Re: Forcing unit test runner to abort after failed test

2007-05-22 Thread simonbun

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
-~--~~~~--~~--~--~---



Re: Forcing unit test runner to abort after failed test

2007-05-18 Thread simonbun

Apparently I can't see very far... Unit tests do not run in reversed
order. It appears to be alphabetically ordered.

I'm still wondering how to abort the test runner without losing my
stack traces though.

Regards,
Simon

On May 18, 11:26 am, 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 unit test.
>
> As far as I can tell, unit tests get run in reversed order (newer
> first). Which is great, because this allows me to instantly see if the
> new unit test fails (F) or throws an error (E). However, when that
> first F or E appears I want to be able to abort all further testing
> and show the stack traces for the tests that have failed.
>
> I've tried hitting ctrl+d for exit, nothing happens. Hitting ctrl+c
> aborts the test runner immediately, without showing the stack traces
> for the unit tests.
>
> Is there a way to achieve what I want?
>
> Thanks,
> Simon


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Forcing unit test runner to abort after failed test

2007-05-18 Thread Russell Keith-Magee

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 unit test.
>
> 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 given test class. Test classes 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 the test runner to add
the ability to run a specific test case or test class 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
-~--~~~~--~~--~--~---



Re: Forcing unit test runner to abort after failed test

2007-05-18 Thread simonbun

Ah, should have refreshed before replying...I had placed a test_a,
test_z, test_zz in a particular test class 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 unit test.
>
> > 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 given test class. Test classes 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 the test runner to add
> the ability to run a specific test case or test class 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
-~--~~~~--~~--~--~---



Forcing unit test runner to abort after failed test

2007-05-18 Thread simonbun

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 unit test.

As far as I can tell, unit tests get run in reversed order (newer
first). Which is great, because this allows me to instantly see if the
new unit test fails (F) or throws an error (E). However, when that
first F or E appears I want to be able to abort all further testing
and show the stack traces for the tests that have failed.

I've tried hitting ctrl+d for exit, nothing happens. Hitting ctrl+c
aborts the test runner immediately, without showing the stack traces
for the unit tests.

Is there a way to achieve what I want?

Thanks,
Simon


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---