1. 如果你想查询在你的环境下有哪些pytest的active plugin可以使用:
py.test --traceconfig
会得到一个扩展的头文件名显示激活的插件和他们的名字。同时也会打印出当前的plugin,也就是被加载时conftest.py文件。
2. pytest.ini文件有什么作用
3. pytest的fixture究竟是怎么工作的,在pytest中它有怎样的作用。
Dealing with fixtures is one of the areas where pytest really shines.
It's to think of fixtures as a set of resources that need to be set up before a test starts, and cleaned up after.
有四种作用域的fixture,分别为function,class,module和session作用域。简单理解function scope,就是每一个函数都会调用;class scope,就是每一个类调用一次,一个类可以有多个函数;module scope,应该是一个文件调用一次,该文件内又有多个function;session scope范围更大,是多个文件调用一次,每个文件有对应着一个module。
function | Run once per test |
class | Run once per class of tests |