有没有办法在python unittest框架中的每个测试用例之前调用相同的函数?
Sounds like you should investigate setUp()
setUp()
Method called to prepare the test fixture. This is called immediately before calling the test method; any exception raised by this method will be considered an error rather than a test failure. The default implementation does nothing.
这就是unittest.TestCase
子类的setUp
方法的用途。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.