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
Fixed issue where fixtures get called with NOT_USED as a parameter when using a fixture_union. This issue is actually only fixed in @pytest_fixture_plus, if you use @pytest.fixture you have to handle it manually. Fixes#37
Copy file name to clipboardExpand all lines: docs/index.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,14 +240,13 @@ The topic has been largely discussed in [pytest-dev](https://github.com/pytest-d
240
240
`fixture_union` is an implementation of this proposal.
241
241
242
242
```python
243
-
import pytest
244
-
from pytest_cases import fixture_union
243
+
from pytest_cases import pytest_fixture_plus, fixture_union
245
244
246
-
@pytest.fixture
245
+
@pytest_fixture_plus
247
246
deffirst():
248
247
return'hello'
249
248
250
-
@pytest.fixture(params=['a', 'b'])
249
+
@pytest_fixture_plus(params=['a', 'b'])
251
250
defsecond(request):
252
251
return request.param
253
252
@@ -271,6 +270,7 @@ PASSED
271
270
272
271
This feature has been tested in very complex cases (several union fixtures, fixtures that are not selected by a given union but that is requested by the test function, etc.). But if you find some strange behaviour don't hesitate to report it in the [issues](https://github.com/smarie/python-pytest-cases/issues) page !
273
272
273
+
**IMPORTANT** if you do not use `@pytest_fixture_plus` but only `@pytest.fixture`, then you will see that your fixtures are called even when they are not used, with a parameter `NOT_USED`. This symbol is automatically ignored if you use `@pytest_fixture_plus`, otherwise you have to handle it.
274
274
275
275
!!! note "fixture unions vs. cases"
276
276
If you're familiar with `pytest-cases` already, you might note `@cases_data` is not so different than a fixture union: we do a union of all case functions. If one day union fixtures are directly supported by `pytest`, we will probably refactor this lib to align all the concepts.
0 commit comments