unittest 中用于跳过 test method, test class,的相关装饰器
来源:互联网 发布:军训教官 知乎 编辑:程序博客网 时间:2024/06/18 02:45
可以使用unitest.skip
装饰器族跳过test method
或者test class
,这些装饰器包括:
① @unittest.skip(reason)
:无条件跳过测试,reason
描述为什么跳过测试
② @unittest.skipif(conditition,reason)
:condititon
为true
时跳过测试
③ @unittest.skipunless(condition,reason)
:condition
不是true
时跳过测试
class MyTestCase(unittest.TestCase): @unittest.skip("demonstrating skipping") def test_nothing(self): self.fail("shouldn't happen") @unittest.skipIf(mylib.__version__ < (1, 3), "not supported in this library version") def test_format(self): # Tests that work for only a certain version of the library. pass @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") def test_windows_support(self): # windows specific testing code pass@unittest.skip("showing class skipping")class MySkippedTestCase(unittest.TestCase): def test_not_run(self): pass
阅读全文
0 0
- unittest 中用于跳过 test method, test class,的相关装饰器
- unittest 中用于 skip 跳过 test method, test class,的相关装饰器
- Maven 跳过test的命令
- unittest skip test
- static>suite>test>class>method testng
- maven编译的时候跳过test
- maven编译的时候跳过test
- maven编译的时候跳过test
- maven install跳过test
- maven 编译 跳过test
- Python unittest parametrized test cases
- Golang UnitTest单元测试(go test)
- 【解决办法】Method 'initializationError' not found.Opening the test class
- Maven编译时跳过Test
- Maven编译时跳过Test
- maven install 跳过 测试 test
- maven打包时跳过test
- maven install 跳过 测试 test
- 微信小程序 开发列表
- iOS 开发中经常使用的到宏
- Spring JdbcTemplate使用实例
- ElasticSearch5.3插件开发(二)获取集群健康信息
- 微信小程序ajax请求到自己的网站
- unittest 中用于跳过 test method, test class,的相关装饰器
- 最详细的Log4教程
- 配置ADS,使ADS编译出bin文件,并使用uboot下载运行成功
- 二分图——洛谷P3386 【模板】二分图匹
- CodeForces 810C Do you want a date? 【数学】【排序】
- 漫画赏析:Linux 内核到底长啥样
- Django 博客开发教程 16
- android 开机启动桌面程序,launcher模式
- n-queens