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


Groups > comp.lang.python > #26147

Re: Initial nose experience

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: Initial nose experience
Date 2012-07-27 10:51 -0400
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-5B2150.10514727072012@news.panix.com> (permalink)
References <roy-F2685A.08422113072012@news.panix.com>

Show all headers | View raw


In article <roy-F2685A.08422113072012@news.panix.com>,
 Roy Smith <roy@panix.com> wrote:

> Lastly, nose, by default, doesn't say much.  When things go wrong and 
> you have no clue what's happening, --verbose and --debug are your 
> friends.

I found another example of nose not saying much, and this one is kind of 
annoying.  Unittest has much richer assertions, and better reporting 
when they fail.  If a nose assertion fails, you just get:

------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/home/roy/production/python/lib/python2.6/site-packages/nose/case.py", 
line 197, in runTest
    self.test(*self.arg)
  File "/home/roy/songza/pyza/djapi/test_middleware.py", line 48, in 
test_update_non_json_cookie
    assert user_list == [9990]
AssertionError
------------------------------------------------------------------

Under unittest, it would have printed the value of user_list.  Yeah, I 
know, I can stick a "print user_list" statement into the test, and the 
output will get suppressed if the test fails.  But that means when a 
test fails, I need to go back and edit the test code, which is a pain.

On the other hand, there *is* an incremental efficiency gain of writing:

assert x == y

instead of

assertEqual(x, y)

many times.  So maybe overall it's a wash.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Initial nose experience Roy Smith <roy@panix.com> - 2012-07-13 08:42 -0400
  Re: Initial nose experience python@bdurham.com - 2012-07-15 14:02 -0400
    Re: Initial nose experience Roy Smith <roy@panix.com> - 2012-07-15 14:58 -0400
      Re: Initial nose experience Philipp Hagemeister <phihag@phihag.de> - 2012-07-16 12:54 +0200
      Re: Initial nose experience Peter Otten <__peter__@web.de> - 2012-07-16 13:47 +0200
      unittest: Improve discoverability of discover (Was: Initial nose experience) Philipp Hagemeister <phihag@phihag.de> - 2012-07-16 14:37 +0200
        Re: unittest: Improve discoverability of discover Ben Finney <ben+python@benfinney.id.au> - 2012-07-16 22:45 +1000
      Re: unittest: Improve discoverability of discover (Was: Initial nose experience) Philipp Hagemeister <phihag@phihag.de> - 2012-07-16 14:49 +0200
    Re: Initial nose experience Roy Smith <roy@panix.com> - 2012-07-16 07:33 -0400
      Re: Initial nose experience Ben Finney <ben+python@benfinney.id.au> - 2012-07-16 22:37 +1000
  Re: Initial nose experience Roy Smith <roy@panix.com> - 2012-07-23 10:33 -0700
  Re: Initial nose experience Roy Smith <roy@panix.com> - 2012-07-27 10:51 -0400

csiph-web