Python pytest框架的通用运行测试挂钩示例

Python pytest框架的通用运行测试挂钩示例,python,pytest,Python,Pytest,我是pytest新手,试图探索和理解以下通用runtest钩子的工作原理: pytest_runtest_setup pytest_runtest_call pytest_runtest_teardown 我参考了pytest文档,但找不到上述3项下的可靠示例。如果有人能提供一个工作示例/演示或参考链接(如果有的话),那就太好了。提前感谢。请查看\u pytest.runner中的默认实现: 您也可以参考以下答案: 一般来说,pytest\u runtest\u setup/teardown为

我是pytest新手,试图探索和理解以下通用
runtest
钩子的工作原理:

pytest_runtest_setup
pytest_runtest_call
pytest_runtest_teardown

我参考了pytest文档,但找不到上述3项下的可靠示例。如果有人能提供一个工作示例/演示或参考链接(如果有的话),那就太好了。提前感谢。

请查看
\u pytest.runner中的默认实现:

您也可以参考以下答案:

一般来说,
pytest\u runtest\u setup
/
teardown
为插件运行的测试实现setup或teardown(非常类似于测试类的setup和teardown)


pytest\u runtest\u call
实际运行测试。

查看
\u pytest.runner中的默认实现:

您也可以参考以下答案:

一般来说,
pytest\u runtest\u setup
/
teardown
为插件运行的测试实现setup或teardown(非常类似于测试类的setup和teardown)

pytest\u runtest\u call
实际运行测试