pytest skip
时间: 2023-08-23 17:18:10 浏览: 157
pytest中的skip是一种用于跳过测试用例的装饰器。可以使用@pytest.mark.skip()或@pytest.mark.skipif()来标记要跳过的测试用例、类、模块、文件或目录。\[1\]在类中使用skip或skipif装饰器时,需要将装饰器放在要跳过的类上面。\[2\]另外,pytest还提供了pytest.importorskip()和pytest.skip(allow_module_level=True)两种方法来在模块的引入阶段跳过剩余部分。\[3\]这些装饰器和方法可以根据条件来决定是否跳过测试用例,可以通过reason参数来提供跳过的原因。
#### 引用[.reference_title]
- *1* *3* [10、pytest -- skip和xfail标记](https://blog.csdn.net/fyyaom/article/details/102938704)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [pytest篇8-pytest之skip/skipif跳过用例](https://blog.csdn.net/m0_47127594/article/details/115744236)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文