0
我写一个测试套件为:单元测试,误差在设置类
class MySuite(unnitest.Testcase):
@classmethod
def setUpclass(cls):
try:
***some code which will throw exception***
except Exception as e:
print('Error Thrown')
@classmethod
def tearDownClass(cls):
print('In teardown')
def test_demo(self):
print('In test_demo')
的问题是,虽然错误将设置被抛出(因为5/0),该test_demo将被执行,我不想这样做。
什么是最好的方法来停止执行test_demo只要在安装方法中有错误。
如果删除了'尝试,except'在你的设置,只允许在发生什么异常传播? – DNA 2015-04-01 08:22:29