
roy at panix
Jul 27, 2012, 7:51 AM
Post #9 of 9
(337 views)
Permalink
|
In article <roy-F2685A.08422113072012 [at] news>, Roy Smith <roy [at] panix> 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. -- http://mail.python.org/mailman/listinfo/python-list
|