有没有收集安装/下载的方法?如果设置/拆卸错误,我可以恢复它吗?例如,我测试了一个应用程序。
collection = list()
SESSION:
setup -> sucess # record it in to my collection collection.append(session.setup)
case 1:
setup -> sucess # record it in to my collection collection.append(case1.setup)
test -> sucess
teardown-> sucess # remove from my collection collection.remove(case1.setup)
case 2:
setup -> fail # traversing collections and run all setup again发布于 2022-05-18 13:53:49
我认为你的问题可以通过使用正确的范围和产量的夹具来解决。当然,你可以根据你想要他们做的事情来改变功能/夹具。
@pytest.fixture(scope="session")
def my_session_setup():
my_setup_init()
@pytest.fixture()
def my_function_setup():
my_setup_init()
yield
my_setup_clean_up()
def test_first(my_session_setup, my_function_setup):
pass
def test_second(my_function_setup):
passhttps://stackoverflow.com/questions/72287989
复制相似问题