Skip to content

Commit 7491dce

Browse files
author
Sylvain MARIE
committed
Minor doc update
1 parent 7aa5caf commit 7491dce

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

docs/index.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -506,18 +506,23 @@ You will for example obtain this kind of pivoted table:
506506

507507
As explained in the sections on [fixtures in generator mode](#f-using-pytest-fixtures-in-generator-mode)
508508
and [fixtures in explicit mode](#f-using-pytest-fixtures-in-explicit-mode),
509-
a function level fixture will behave differently in a generator-style test than in a test with explicit-style steps.
510-
If a pytest-steps test is generator-style, the pytest-harvest
511-
[`results_bag`](https://smarie.github.io/python-pytest-harvest/#b-collecting-test-artifacts)
512-
will behave like a cross-step fixture. If the test is explict-style, it will
513-
behave like a per-step fixture.
514-
515-
For generator-style test steps, the `step_bag` fixture is a version of the pytest-harvest
516-
[`results_bag`](https://smarie.github.io/python-pytest-harvest/#b-collecting-test-artifacts)
517-
fixture, but decorated with [`@one_fixture_per_step`](/api_reference/#one_fixture_per_step)
518-
if you wish to have the opposite of the default behavior.
519-
Similarly, for explict-style test steps, the `cross_bag` fixture provides the `results_bag`
520-
as decorated with [`@cross_step_fixture](/api_reference/#cross_step_fixture).
509+
a function-scoped fixture will behave differently in a generator-style test than in a test with explicit-style steps.
510+
511+
This impacts the pytest-harvest
512+
[`results_bag`](https://smarie.github.io/python-pytest-harvest/#b-collecting-test-artifacts) fixture:
513+
514+
- If a pytest-steps test is generator-style, `results_bag` will behave like a
515+
cross-step fixture.
516+
517+
- If the test is explict-style, `results_bag` will behave like a per-step fixture.
518+
519+
This is not very intuitive and it is easy to get lost. Besides you may wish to have an opposite behaviour than the above. For all these reasons, you should rather use the following built-in two fixtures:
520+
521+
- `step_bag` is a version of `results_bag`, decorated with [`@one_fixture_per_step`](/api_reference/#one_fixture_per_step)
522+
523+
- `cross_bag` is a version of `results_bag`, decorated with [`@cross_step_fixture`](/api_reference/#cross_step_fixture).
524+
525+
See also [API reference](api_reference/#pytest-harvest-fixtures).
521526

522527
### d- Examples
523528

0 commit comments

Comments
 (0)