Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68271
| Date | 2014-03-12 03:03 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: unittest weirdness |
| References | <mailman.8062.1394573210.18130.python-list@python.org> <lfo1qj$3m3$1@reader1.panix.com> <lfokoh$3q3$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.8082.1394620172.18130.python-list@python.org> (permalink) |
On 03/11/2014 08:36 PM, Terry Reedy wrote:
> On 3/11/2014 6:13 PM, John Gordon wrote:
>> In <mailman.8062.1394573210.18130.python-list@python.org> Ethan Furman <ethan@stoneleaf.us> writes:
>>
>>> if missing:
>>> raise ValueError('invoices %r missing from batch' % missing)
>>
>> It's been a while since I wrote test cases, but I recall using the assert*
>> methods (assertEqual, assertTrue, etc.) instead of raising exceptions.
>> Perhaps that's the issue?
>
> Yes. I believe the methods all raise AssertionError on failure, and the test methods are wrapped with try:.. except
> AssertionError as err:
>
> if missing:
> raise ValueError('invoices %r missing from batch' % missing)
>
> should be "assertEqual(missing, [], 'invoices missing from batch')" and if that fails, the non-empty list is printed
> along with the message.
I've tried it both ways, and both ways my process is being killed, presumably by the O/S.
I will say it's an extra motivating factor to have few failing tests -- if more than two of my tests fail, all I see are
'.'s, 'E's, and 'F's, with no clues as to which test failed nor why. Thank goodness for '-v' and being able to specify
which method of which class to run!
--
~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
unittest weirdness Ethan Furman <ethan@stoneleaf.us> - 2014-03-11 13:58 -0700
Re: unittest weirdness John Gordon <gordon@panix.com> - 2014-03-11 22:13 +0000
Re: unittest weirdness Ethan Furman <ethan@stoneleaf.us> - 2014-03-11 15:29 -0700
Re: unittest weirdness Terry Reedy <tjreedy@udel.edu> - 2014-03-11 23:36 -0400
Re: unittest weirdness Ethan Furman <ethan@stoneleaf.us> - 2014-03-12 03:03 -0700
Re: unittest weirdness Roy Smith <roy@panix.com> - 2014-03-12 09:44 -0400
Re: unittest weirdness Ethan Furman <ethan@stoneleaf.us> - 2014-03-12 08:32 -0700
Re: unittest weirdness Roy Smith <roy@panix.com> - 2014-03-12 13:48 -0400
Re: unittest weirdness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-12 23:14 +0000
Re: unittest weirdness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-12 23:47 +0000
Re: unittest weirdness Ethan Furman <ethan@stoneleaf.us> - 2014-03-12 17:31 -0700
Re: unittest weirdness Terry Reedy <tjreedy@udel.edu> - 2014-03-12 22:27 -0400
Re: unittest weirdness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-12 23:38 +0000
Re: unittest weirdness Ethan Furman <ethan@stoneleaf.us> - 2014-03-12 17:36 -0700
csiph-web