Skip to content

Commit 09f78ff

Browse files
author
Sylvain MARIE
committed
Improved doc example for current_cases
1 parent 3538124 commit 09f78ff

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,14 @@ yields
521521
}}
522522
```
523523
524-
As you can see above, details are provided as `namedtuple`s. When a case itself is parametrized, its current parameter value(s) appear too (in the above example, `case_a` is parametrized with `nb`).
524+
As you can see above, details are provided as `namedtuple`s. When a case itself is parametrized, its current parameter value(s) appear too (in the above example, `case_a` is parametrized with `nb`). This can be used to skip a test conditionally, for example:
525+
526+
```python
527+
if data_fun is case_a and data_params['nb'] == 1:
528+
pytest.skip("This specific case is skipped")
529+
```
530+
531+
It can also be used to insert a debug breakpoint for a specific case.
525532
526533
To get more information on the case function, you can use `get_case_marks(func)`, `get_case_tags(func)`. You can also use `matches_tag_query(...)` to check if a case function matches some expectations either concerning its id or its tags. See [API reference](./api_reference.md#matches_tag_query).
527534

0 commit comments

Comments
 (0)