Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pytest fixtures scope explained

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.
Source by docs.pytest.org #
 
PREVIOUS NEXT
Tagged: #pytest #fixtures #scope #explained
ADD COMMENT
Topic
Name
5+8 =