I have a utility class that stores methods that are useful for some unit test cases. I want these helper methods to be able to execute the / fail / etc. Statements, but it seems like I can't use these methods because they expect TestCase to be their first argument ...
I want to be able to store common methods outside the code of the test code and continue to use the statements in them, is this even possible? They are ultimately used in the code for verification.
I have something like:
unittest_foo.py:
import unittest
from common_methods import *
class TestPayments(unittest.TestCase):
def test_0(self):
common_method1("foo")
common_methods.py:
from unittest import TestCase
def common_method1():
blah=stuff
TestCase.failUnless(len(blah) > 5)
...
...
When the package is running:
TypeError: unbound method failUnless() must be called with TestCase instance as first argument (got bool instance instead)
source
share