[TIP] testing the creation of infrastructure

Mark Sienkiewicz sienkiew at stsci.edu
Tue Aug 30 11:22:07 PDT 2011


Well, that message sure got mangled on the way out.  Let's try again:

- It is fairly trivial to use a unittest2 assertion without using the rest of unittest:

import unittest2

class dummy_ut2( unittest2.TestCase ) : # not named test_something
    __test__ = False # just in case
    def runTest( wtf ) :
        raise Exception('Should never be called')
xcmp = dummy_ut2()

def test_a() :
    xcmp.assertAlmostEqual( 1.001, 1.002, places=4 )

IMHO, it would be easy to bury all that in a library if you wanted to.



Mark S.



More information about the testing-in-python mailing list