You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -413,7 +413,7 @@ As a consequence it does not support the `params` and `ids` arguments anymore.
413
413
-**autouse**: if True, the fixture func is activated for all tests that can see it. If False (the default) then an explicitreference is needed to activate the fixture.
414
414
-**name**: the name of the fixture. This defaults to the name of the decorated function. Note: If a fixture is used in the same module in which it is defined, the function name of the fixture will be shadowed by the function arg that requests the fixture; one wayto resolve this is to name the decorated function ``fixture_<fixturename>`` and then use ``@pytest.fixture(name='<fixturename>')``.
415
415
-**unpack_into**: an optional iterable of names, or string containing coma-separated names, for additional fixtures to create to represent parts of this fixture. See [`unpack_fixture`](#unpack_fixture) for details.
416
-
-**hook**: an optional hook to apply to each fixture function that is created during this call. The hook function will be called everytime a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture` from `pytest-harvest` as a hook in order to save all such created fixtures in the fixture store.
416
+
-**hook**: an optional hook to apply to each fixture function that is created during this call. The hook function will be called every time a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture` from `pytest-harvest` as a hook in order to save all such created fixtures in the fixture store.
417
417
-**kwargs**: other keyword arguments for `@pytest.fixture`
418
418
419
419
### `unpack_fixture`
@@ -468,7 +468,7 @@ class TestClass:
468
468
-**argnames**: same as `@pytest.mark.parametrize``argnames`.
469
469
-**fixture**: a fixture name string or a fixture symbol. If a fixture symbol is provided, the created fixtures will have the same scope. If a name is provided, they will have scope='function'. Note that in practice the performance loss resulting from using `function` rather than a higher scope is negligible since the created fixtures' body is a one-liner.
470
470
-**in_cls**: a boolean (default `False`). You may wish to turn this to `True` to use this function inside a class. If you do so, you **MUST** assign the output to variables in the class.
471
-
-**hook**: an optional hook to apply to each fixture function that is created during this call. The hook function will be called everytime a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture` from `pytest-harvest` as a hook in order to save all such created fixtures in the fixture store.
471
+
-**hook**: an optional hook to apply to each fixture function that is created during this call. The hook function will be called every time a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture` from `pytest-harvest` as a hook in order to save all such created fixtures in the fixture store.
472
472
473
473
**Outputs:** the created fixtures.
474
474
@@ -510,7 +510,7 @@ leads to very explicit ids: `<union>/<idx>/<alternative>`. See `UnionFixtureAlte
510
510
-`unpack_into`: an optional iterable of names, or string containing coma-separated names, for additional fixtures to create to represent parts of this fixture. See `unpack_fixture`for details.
511
511
-`ids`: asin pytest. The default value returns the correct fixture
512
512
-`autouse`: asin pytest
513
-
-`hook`: an optional hook to apply to each fixture function that is created during this call. The hook function will be called everytime a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
513
+
-`hook`: an optional hook to apply to each fixture function that is created during this call. The hook function will be called every time a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
514
514
-`kwargs`: other pytest fixture options. They might not be supported correctly.
515
515
516
516
**Outputs:** the new fixture. Note: you do not need to capture that output in a symbol, since the fixture is automatically registered in your module. However if you decide to do so make sure that you use the same name.
-`hook`: an optional hook to apply to each fixture function that is created during this call. The hook function will be called everytime a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
558
+
-`hook`: an optional hook to apply to each fixture function that is created during this call. The hook function will be called every time a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
559
559
-`kwargs`: any other argument for the created 'fixtures'
560
560
561
561
### `param_fixture`
@@ -602,7 +602,7 @@ Both `fixture_ref` and `lazy_value` can be used to represent a single argvalue,
602
602
603
603
Finally, `pytest.param`is supported even when there are `fixture_ref`and`lazy_value`.
604
604
605
-
Here asforall functions above, an optional `hook` can be passed, to apply on each fixture function that is created during this call. The hook function will be called everytime a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
605
+
Here asforall functions above, an optional `hook` can be passed, to apply on each fixture function that is created during this call. The hook function will be called every time a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
606
606
607
607
**Parameters**
608
608
@@ -622,7 +622,7 @@ Here as for all functions above, an optional `hook` can be passed, to apply on e
622
622
623
623
-`scope`: The scope of the union fixture to create if`fixture_ref`s are found in the argvalues. Otherwise same asin`pytest.mark.parametrize`.
624
624
625
-
-`hook`: an optional hook to apply to each fixture function that is created during this call. The hook function will be called everytime a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
625
+
-`hook`: an optional hook to apply to each fixture function that is created during this call. The hook function will be called every time a fixture is about to be created. It will receive a single argument (the function implementing the fixture) and should return the function to use. For example you can use `saved_fixture`from`pytest-harvest`as a hook in order to save all such created fixtures in the fixture store.
626
626
627
627
-`debug`: print debug messages on stdout to analyze fixture creation (use pytest -s to see them)
### 1.9.0 - New `--with-reorder` commandline option
492
492
493
-
New commandline option '--with-reorder' to change the reordering startegy currently in application. Fixes [#45](https://github.com/smarie/python-pytest-cases/issues/45).
493
+
New commandline option '--with-reorder' to change the reordering strategy currently in application. Fixes [#45](https://github.com/smarie/python-pytest-cases/issues/45).
494
494
495
495
The `--with-reorder` "skip" mode was not working correctly in presence of marks, fixed it. Fixed [#46](https://github.com/smarie/python-pytest-cases/issues/46).
496
496
@@ -562,7 +562,7 @@ Following [Sup3rGeo](https://github.com/Sup3rGeo)'s proposal, introduced two hel
562
562
563
563
### 1.4.2 - parametrized `@pytest_fixture_plus` minor bug fix
564
564
565
-
`@pytest_fixture_plus` now correctly honors parameter id and marks overriden at single parameter level using `pytest.param`. Fixed [#30](https://github.com/smarie/python-pytest-cases/issues/30).
565
+
`@pytest_fixture_plus` now correctly honors parameter id and marks overridden at single parameter level using `pytest.param`. Fixed [#30](https://github.com/smarie/python-pytest-cases/issues/30).
566
566
567
567
### 1.4.1 - parametrized `@pytest_fixture_plus` minor bug fix
Copy file name to clipboardExpand all lines: docs/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -452,7 +452,7 @@ After starting to reuse cases in several test functions, you might end-up thinki
452
452
453
453
That being said, **if you are certain that your tests do not modify your cases data**, there are several ways to solve this issue:
454
454
455
-
- the easiest way is to **use fixtures with a broad scope**, as explained [above](#b-parametrizing-fixtures). However in some parametrization scenarii, `pytest` does not guarantee that the fixture will be setup only once for the whole session, even if it is a session-scoped fixture. Also the cases will be parsed everytime you run pytest, which might be cumbersome
455
+
- the easiest way is to **use fixtures with a broad scope**, as explained [above](#b-parametrizing-fixtures). However in some parametrization scenarii, `pytest` does not guarantee that the fixture will be setup only once for the whole session, even if it is a session-scoped fixture. Also the cases will be parsed every time you run pytest, which might be cumbersome
456
456
457
457
```python
458
458
from pytest_cases import parametrize, parametrize_with_cases, fixture
Copy file name to clipboardExpand all lines: docs/pytest_goodies.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -272,7 +272,7 @@ Another consequence of using [`fixture_ref`](./api_reference.md#fixture_ref) is
272
272
273
273
## passing a `hook`
274
274
275
-
As per version `1.14`, all the above functions now support passing a `hook` argument. This argument should be a callable. It will be called everytime a fixture is about to be created by `pytest_cases` on your behalf. The fixture function is passed as the argument of the hook, and the hook should return it as the result.
275
+
As per version `1.14`, all the above functions now support passing a `hook` argument. This argument should be a callable. It will be called every time a fixture is about to be created by `pytest_cases` on your behalf. The fixture function is passed as the argument of the hook, and the hook should return it as the result.
276
276
277
277
You can use this fixture to better understand which fixtures are created behind the scenes, and also to decorate the fixture functions before they are created. For example you can use `hook=saved_fixture` (from [`pytest-harvest`](https://smarie.github.io/python-pytest-harvest/)) in order to save the created fixtures in the fixture store.
0 commit comments