Skip to content

Commit 3f03625

Browse files
authored
Merge pull request #4070 from jeffreyrack/4058-update-fixture-docs
Update documentation to indicate a fixture can be invoked more than once in it's scope.
2 parents 20f93ae + c5dec60 commit 3f03625

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

changelog/4058.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update fixture documentation to specify that a fixture can be invoked twice in the scope it's defined for.

doc/en/fixture.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ instance, you can simply declare it:
259259
260260
Finally, the ``class`` scope will invoke the fixture once per test *class*.
261261

262+
.. note::
263+
264+
Pytest will only cache one instance of a fixture at a time.
265+
This means that when using a parametrized fixture, pytest may invoke a fixture more than once in the given scope.
266+
262267

263268
``package`` scope (experimental)
264269
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)