[Peter Hansen]
> unittest can really be rather light.  Most of our
> test cases are variations on the following, with
> primarily application-specific code added rather than
> boilerplate or other unittest-related stuff:
>
> import unittest
>
> class TestCase(unittest.TestCase):
>      def test01(self):
>          '''some test....'''
>          self.assertEquals(a, b)
>
>      def test02(self):
>          '''another test'''
>          self.assertRaises(Error, func, args)
 . . .
> I'm a little puzzled why folks so often consider this
> particularly "heavy".

unittest never felt heavy to me until I used py.test.  Only then do you realize
how much boilerplate is needed with unittest.  Also, the whole py.test approach
has a much simpler object model.

BTW, the above code simplifies to:

from py.test import raises
assert a == b
raises(Error, func, args)


Raymond Hettinger


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to