普通代码案例:
python本身执行
import pytestdef init_new():print("init_new...")return Truedef test_case(init_new):if init_new is True:print("如果init_new返回True,就执行用例test_case")if __name__ =='__main__':#用python本身执行ee=init_new()test_case(init_new=ee)
fixture装饰器运行:
import pytest
#装饰器fixture执行
@pytest.fixture()
def init_new():print("init_new...")return Truedef test_case(init_new):if init_new is True:print("如果init_new返回True,就执行用例test_case")