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
|`report_context`| fixture (autouse) | session | The `ReportContext` backing the run's `TestReport`. Use it to attach metadata or open ad-hoc steps. |
89
-
|`step`| fixture (autouse) | function | A `NewStep` created for the current test function. Exposes `measure*`, `substep`, `report_outcome`, and `current_step`. |
89
+
|`step`| fixture (autouse) | function | A `NewStep` created for the current test function. Exposes `measure*`, `substep`, `report_outcome`, `fail_if_measurements_failed`, and `current_step`. |
90
90
|`_hierarchy_parents`| internal fixture (autouse) | function | Opens a parent step for each `pytest.Package`, `pytest.Module`, and `pytest.Class` ancestor of the current test. Each layer is gated independently — see [ini options](#ini-options). |
91
91
|`_parametrize_parents`| internal fixture (autouse) | function | Opens a parent step for each `@pytest.mark.parametrize` axis (and fixture parametrization), nested inside the hierarchy parents. |
92
92
|`client_has_connection`| fixture | session | Calls `sift_client.ping.ping()`; consulted by `report_context` at session start in online mode (the default). Override to skip the ping or use a different reachability signal. |
@@ -97,12 +97,13 @@ The `with_sift` module shows two patterns for handling measurement results:
97
97
`test_failed_measurement_marks_sift_step_failed` lets the test keep passing
98
98
in pytest while the Sift step is `FAILED` (useful when measurements are
99
99
diagnostic data you want to collect regardless of outcome); and
100
-
`test_assert_measurements_passed_at_end` takes every measurement first and
101
-
then asserts`step.measurements_passed` once at the end, so every
100
+
`test_fail_if_measurements_failed_at_end` takes every measurement first and
101
+
then calls`step.fail_if_measurements_failed()` once at the end, so every
102
102
measurement still lands in the report even when one fails. The end-of-test
103
-
assertion is the recommended pattern: asserting on an individual
104
-
`step.measure(...)` call short-circuits on the first failure and skips
105
-
every measurement that follows. Expected
103
+
call is the recommended pattern: it fails via `pytest.fail` (no assertion
104
+
noise in `error_info`), and unlike asserting on an individual
105
+
`step.measure(...)` call it does not short-circuit on the first failure and
106
+
skip every measurement that follows. Expected
106
107
pytest output is `16 passed, 3 failed, 1 skipped`.
107
108
108
109
Toggle any of the `sift_*_step` / `sift_parametrize_nesting` flags in
@@ -115,5 +116,5 @@ Toggle any of the `sift_*_step` / `sift_parametrize_nesting` flags in
115
116
|`conftest.py`| Plugin registration via `pytest_plugins`; optional `load_dotenv()`|
116
117
|`pytest.ini`| The four nesting flags + git metadata flag at their defaults |
117
118
|`tests/pytest_only/test_pytest_only_demo.py`| Plain pytest tests with no Sift APIs. The plugin captures pass/fail automatically; covers functions, fixtures, parametrize, classes, plus one each of `AssertionError` (FAILED), `pytest.skip` (SKIPPED), and a raised `ValueError` (ERROR) |
118
-
|`tests/with_sift/test_with_sift_demo.py`|`step.measure` (numeric/string/bool bounds, units, description, metadata, `channel_names`), `step.measure_avg` and `step.measure_all` for series, an out-of-bounds measurement (pytest PASSED, Sift step FAILED), the recommended `assert step.measurements_passed` end-of-test pattern that fails pytest while still recording every measurement, nested `step.substep` (with step-level `metadata=...`), `@pytest.mark.sift_exclude`, class step + class docstring → description, nested classes, stacked `@pytest.mark.parametrize`, `step.report_outcome`, and session-level metadata via `report_context.report.update({...})`|
119
+
|`tests/with_sift/test_with_sift_demo.py`|`step.measure` (numeric/string/bool bounds, units, description, metadata, `channel_names`), `step.measure_avg` and `step.measure_all` for series, an out-of-bounds measurement (pytest PASSED, Sift step FAILED), the recommended `step.fail_if_measurements_failed()` end-of-test call that fails pytest while still recording every measurement, nested `step.substep` (with step-level `metadata=...`), `@pytest.mark.sift_exclude`, class step + class docstring → description, nested classes, stacked `@pytest.mark.parametrize`, `step.report_outcome`, and session-level metadata via `report_context.report.update({...})`|
119
120
|`tests/{pytest_only,with_sift}/__init__.py`| Each Python package (directory with `__init__.py`) becomes a parent step in the report tree |
0 commit comments