Skip to content

Commit f3b259c

Browse files
committed
add missing files
1 parent f72bf23 commit f3b259c

1 file changed

Lines changed: 39 additions & 5 deletions

File tree

python/docs/examples/pytest_plugin.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,9 @@ TestReport
451451
452452
### Parametrized tests
453453
454-
Each parametrize case is a distinct pytest node, so each gets its own step.
455-
The step name includes the parameter id pytest generates.
454+
Parametrized cases nest under a single shared parent named after the
455+
function. Each case becomes a leaf step named `<param>=<value>`, where
456+
`<value>` is `repr()`d so strings get quoted.
456457
457458
```python
458459
@pytest.mark.parametrize("voltage", [3.3, 5.0, 12.0])
@@ -462,11 +463,44 @@ def test_rail(step, voltage):
462463
463464
```text title="Sift report"
464465
TestReport
465-
├── test_rail[3.3]
466-
├── test_rail[5.0]
467-
└── test_rail[12.0]
466+
└── test_rail
467+
├── voltage=3.3
468+
├── voltage=5.0
469+
└── voltage=12.0
468470
```
469471
472+
Stacked `@pytest.mark.parametrize` decorators nest outer-to-inner. The
473+
**top** decorator is the outermost axis, the **bottom** is the innermost
474+
leaf. Sibling cases that share a prefix reuse the same parent step.
475+
476+
```python
477+
@pytest.mark.parametrize("voltage", ["high", "low"])
478+
@pytest.mark.parametrize("component", ["motor", "ducer"])
479+
def test_iso(step, voltage, component): ...
480+
```
481+
482+
```text title="Sift report"
483+
TestReport
484+
└── test_iso
485+
├── voltage='high'
486+
│ ├── component='motor'
487+
│ └── component='ducer'
488+
└── voltage='low'
489+
├── component='motor'
490+
└── component='ducer'
491+
```
492+
493+
Parametrized fixtures (`@pytest.fixture(params=[...])`) participate in
494+
the same tree. Each `param` axis becomes a level just as if it had been
495+
declared via `@pytest.mark.parametrize`.
496+
497+
!!! note "Item ordering"
498+
To make sibling cases cluster, the plugin sorts collected items by
499+
their parametrize path in `pytest_collection_modifyitems`. If you
500+
rely on a specific run order (e.g. via `pytest-ordering`), apply
501+
your ordering plugin *after* `sift_client.pytest_plugin` in the
502+
`pytest_plugins` list.
503+
470504
### Helper functions
471505
472506
Helpers called from a test do not auto-create a step. The plugin only sees

0 commit comments

Comments
 (0)