摘要:
def init_data(): data = [{"zhang", "123"}, {"lisang", "456"}] return data class test_skip: #单个参数 @pytest.mark.parametrize('name', ["tom", "zhang", "ju 阅读全文
摘要:
使用方法: @pytest.mark.skipif(condition,reason=None) 参数: condition:跳过的条件,True(跳过、不执行)/False(不跳过、执行),必传参数 reason:标注原因 class test_skip: n=5 @pytest.mark.ski 阅读全文
摘要:
pytest中使用fixture装饰器是来固定的工厂函数,fixture函数可以在测试执行前和执行后进行必要的准备和清理工作 1. fixture做为函数引用使用 比如以下 import pytest # fixture作为函数引用 @pytest.fixture() def before(): p 阅读全文
摘要:
使用pytest控制函数运行的函数 需要使用 (1)使用 @pytest.mark.run(order=x) 标记被测试函数 (2)运行的顺序由order传入的参数决定;(order从小到大的顺序执行) import pytest class Calc(object): @classmethod d 阅读全文