📜  pytest 固定装置范围解释 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:01.251000             🧑  作者: Mango

代码示例1
Fixture scopes
Fixtures are created when first requested by a test, and are destroyed based on their scope:

function: the default scope, the fixture is destroyed at the end of the test.

class: the fixture is destroyed during teardown of the last test in the class.

module: the fixture is destroyed during teardown of the last test in the module.

package: the fixture is destroyed during teardown of the last test in the package.

session: the fixture is destroyed at the end of the test session.