Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68271

Re: unittest weirdness

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'failing': 0.07; '[],': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'missing)': 0.09; 'wrapped': 0.09; '~ethan~': 0.09; 'wrote': 0.14; 'clues': 0.16; 'err:': 0.16; 'fail,': 0.16; 'issue?': 0.16; 'reedy': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'tests': 0.22; 'header :User-Agent:1': 0.23; 'specify': 0.24; 'why.': 0.24; "i've": 0.25; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'raise': 0.29; 'along': 0.30; 'factor': 0.31; 'writes:': 0.31; 'yes.': 0.31; 'class': 0.32; 'message.': 0.35; 'except': 0.35; 'etc.)': 0.35; 'test': 0.35; 'but': 0.35; 'raising': 0.36; 'method': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'two': 0.37; 'list': 0.37; 'being': 0.38; 'thank': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'john': 0.61; 'received:173': 0.61; 'more': 0.64; 'believe': 0.68; 'ethan': 0.84; 'fails,': 0.84; 'furman': 0.84; 'presumably': 0.84
Date Wed, 12 Mar 2014 03:03:24 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version 1.0
To python-list@python.org
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>
In-Reply-To <lfokoh$3q3$1@ger.gmane.org>
Content-Type text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator3304.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source-IP 173.12.184.233
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender ([173.12.184.233]) [173.12.184.233]:35376
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 1
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8082.1394620172.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1394620172 news.xs4all.nl 2865 [2001:888:2000:d::a6]:59417
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68271

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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