setUp和tearDown及setUpClass和tearDownClass的用法及区别

① setup():每个测试函数运行前运行
② teardown():每个测试函数运行完后执行

③ setUpClass():必须使用@classmethod 装饰器,所有test运行前运行一次

④ tearDownClass():必须使用@classmethod装饰器,所有test运行完后运行一次

原文地址:https://www.cnblogs.com/yhleng/p/8057336.html