I have a unittest.TestCase child, which defines several domain specific assert Checks. I would like to run some unittests to unittest this functionality to control that everything work on future updates.
class MyBaseTestCase(unittest.TestCase):
def setUp(self):
...
def tearDown(self):
...
def run(self, result):
...
def assertSpec(self, condition, message):
...
I want to instantiate MyBaseTestCase in other unit test, like this:
class TestBase(unittest.TestCase):
def test_assertSpec(self):
self.testclass = MyBaseTestCase()
self.assertRaises(AssertionError, self.testclass.assertSpec, False)
I'm encountering multiple different errors, when doing this, so my question is what is a common practice for unittesting custom unittest functions?
In case it helps:
$ jython
>>> import sys
>>> sys.version
'2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) \n[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)]'
Not sure if there's anything Jython specific that would break this, but I would do something like this: