我有很多方法需要测试。我想实现一个检查,以确保我已经为每个方法编写了一个测试。如果我保持一个运行测试的列表,我可以在我的tearDownClass()中检查这个,但是我无法从中找出失败的方法。在
如果我尝试这样做:
class TestSystem(unittest.TestCase):
class TestAB(TestSystem):
@classmethod
def setUpClass(self):
print "ABSetup"
@classmethod
def tearDownClass(self):
if (testsNotImplemented()):
self.fail() #I'd like to fail TestAB here
print "ABTeardown"
我得到一个类型错误:unbound method fail() must be called with TestAB instance as first argument (got type instance instead)
正确的方法是什么?即使只是打印一条消息也可以(如果不理想的话),但是据我所知,wing不通过setup和teardown方法输出“print”消息。在
This问题类似,但我不希望测试崩溃,只要失败就好。在
目前没有回答
相关问题 更多 >
编程相关推荐