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
@parametrize_with_cases now explicitly supports all id customization methods (ids, idgen and idstyle) supported by @parametrize (ids, idgen and idstyle). Updated documentation accordingly. Fixed#151
-`has_tag`: a single tag or a tuple, set, list of tags that should be matched by the ones set with the [`@case`](#case) decorator on the case function(s) to be selected.
78
81
79
82
-`filter`: a callable receiving the case function and returning True or a truth value in case the function needs to be selected.
80
-
83
+
84
+
-`ids`: same as in pytest.mark.parametrize. Note that an alternative way to create ids exists with `idgen`. Only one non-None `ids` or `idgen` should be provided. See [`@parametrize`](#parametrize) for details.
85
+
86
+
-`idgen`: an id formatter. Either a string representing a template, or a callable receiving all argvalues at once (as opposed to the behaviour in pytest ids). This alternative way to generate ids can only be used when `ids` is not provided (None). You can use the special `pytest_cases.AUTO` formatter to generate an automatic id with template `<name>=<value>-<name2>=<value2>-...`. See [`@parametrize`](#parametrize) for details.
87
+
88
+
-`idstyle`: style of ids to be used in the "union" fixtures generated by [`@parametrize`](#parametrize) when some cases require fixtures. One of 'compact', 'explicit' or None/'nostyle'. See [`@parametrize`](#parametrize) for details.
81
89
82
90
### `get_all_cases`
83
91
@@ -272,16 +280,16 @@ Identical to `param_fixtures` but for a single parameter name, so that you can a
272
280
### `@parametrize`
273
281
274
282
```python
275
-
@parametrize_plus(argnames: str=None,
276
-
argvalues: Iterable[Any]=None,
277
-
indirect: bool=False,
278
-
ids: Union[Callable, Iterable[str]] =None,
279
-
idstyle: str='explicit',
280
-
idgen: Union[str, Callable] =_IDGEN,
281
-
scope: str=None,
282
-
hook: Callable=None,
283
-
debug: bool=False,
284
-
**args)
283
+
@parametrize(argnames: str=None,
284
+
argvalues: Iterable[Any]=None,
285
+
indirect: bool=False,
286
+
ids: Union[Callable, Iterable[str]] =None,
287
+
idstyle: Optional[str]='explicit',
288
+
idgen: Union[str, Callable] =_IDGEN,
289
+
scope: str=None,
290
+
hook: Callable=None,
291
+
debug: bool=False,
292
+
**args)
285
293
```
286
294
287
295
Equivalent to `@pytest.mark.parametrize` but also supports
@@ -302,6 +310,29 @@ Finally, `pytest.param` is supported even when there are `fixture_ref` and `lazy
302
310
303
311
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.
304
312
313
+
**Parameters**
314
+
315
+
-`argnames`: same than in`@pytest.mark.parametrize`
316
+
317
+
-`argvalues: same asin pytest.mark.parametrize except that `fixture_ref` and `lazy_value` are supported
318
+
319
+
-`indirect`: same asin pytest.mark.parametrize. Note that it isnot recommended andisnot guaranteed to work incomplex parametrization scenarii.
320
+
321
+
-`ids`: same asin pytest.mark.parametrize. Note that an alternative way to create ids exists with`idgen`. Only one non-None`ids`or`idgen` should be provided.
322
+
323
+
-`idgen`: an id formatter. Either a string representing a template, or a callable receiving all argvalues at once (as opposed to the behaviour in pytest ids). This alternative way to generate ids can only be used when `ids`isnot provided (None). You can use the special `pytest_cases.AUTO` formatter to generate an automatic idwith template `<name>=<value>-<name2>=<value2>-...`.
324
+
325
+
-`idstyle`: style of ids to be used in the "union" fixtures generated by `@parametrize` when some cases require fixtures. One of 'compact', 'explicit'orNone/'nostyle'.
326
+
327
+
-`scope`: same asin pytest.mark.parametrize
328
+
329
+
-`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.
330
+
331
+
-`debug`: print debug messages on stdout to analyze fixture creation (use pytest -s to see them)
0 commit comments