Skip to content

Python(feat): hierarchical pytest report tree (packages, modules, classes, parametrize)#570

Merged
alexluck-sift merged 8 commits into
al/python/feat/pytest-dev-branchfrom
al/python/feat/pytest-parameterize-support
May 23, 2026
Merged

Python(feat): hierarchical pytest report tree (packages, modules, classes, parametrize)#570
alexluck-sift merged 8 commits into
al/python/feat/pytest-dev-branchfrom
al/python/feat/pytest-parameterize-support

Conversation

@alexluck-sift
Copy link
Copy Markdown
Collaborator

@alexluck-sift alexluck-sift commented May 16, 2026

Summary

  • Hierarchical report tree: Python packages, test modules, test classes (including nested), and @pytest.mark.parametrize axes now each open a nested parent step automatically via a unified diff-stack mechanism. The old module_substep fixture is removed; everything above the leaf is handled by one autouse _hierarchy_parents fixture.
  • Identity-aware diff keyed by node.nodeid (not just name), so two same-named ancestors reached via different paths (e.g. proj_a/utils and proj_b/utils in a monorepo) stay distinct in the report tree.
  • Four ini opt-outs gate the new layers individually: sift_package_step, sift_module_step, sift_class_step, sift_parametrize_nesting (all default true). Frames stay in the diff for identity even when their layer is gated off.
  • New step.measurements_passed property on NewStep for the assert step.measurements_passed end-of-test pattern: fails pytest when any bounds check on this step failed, without short-circuiting on individual measure(...) calls.
  • Drain ordering fix: hierarchy parents now drain inside ReportContext.__exit__ (was draining in pytest_sessionfinish after the import worker had already shut down, leaving parents stuck IN_PROGRESS in Sift).
  • Import worker timeout bumped 1s → 30s; replay instructions now point at the correct import-test-result-log binary; replay failures emit SiftPytestStepDrainWarning instead of a silent logger.error.
  • Defensive drain: per-frame __exit__ failures during teardown warn and continue; mid-session drains use a strict variant that re-raises so genuine invariant violations surface as test errors.
  • Runnable demo at python/examples/pytest_plugin/ plus a new pytest_plugin_quickstart.md mkdocs page that snippets the demo files. pytest_plugin.md updated for the new ini knobs.
  • Tests: test_hierarchy.py pytester suite covers classes, nested classes, packages, opt-out flags, cross-path collisions, and the drain helper; integration test covers the new step.measurements_passed property.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 16, 2026

Python docs preview: https://sift-stack.github.io/sift/python/pr-570/

Deployed from 450bdf5. The link may take up to a minute to become live as GitHub Pages propagates.

@alexluck-sift alexluck-sift changed the base branch from main to al/python/feat/pytest-dev-branch May 17, 2026 22:24
@alexluck-sift alexluck-sift changed the base branch from al/python/feat/pytest-dev-branch to al/python/graceful-handle-missing-connection May 17, 2026 22:27
@alexluck-sift alexluck-sift force-pushed the al/python/graceful-handle-missing-connection branch 2 times, most recently from 93cfa1c to 74b8b05 Compare May 18, 2026 00:04
@alexluck-sift alexluck-sift force-pushed the al/python/feat/pytest-parameterize-support branch from 5448db8 to 941d9c9 Compare May 18, 2026 00:25
@alexluck-sift alexluck-sift force-pushed the al/python/graceful-handle-missing-connection branch 3 times, most recently from 3ae545c to c403740 Compare May 19, 2026 15:22
@alexluck-sift alexluck-sift force-pushed the al/python/feat/pytest-parameterize-support branch from 941d9c9 to a4ba332 Compare May 19, 2026 19:18
Base automatically changed from al/python/graceful-handle-missing-connection to al/python/feat/pytest-dev-branch May 21, 2026 21:40
@alexluck-sift alexluck-sift force-pushed the al/python/feat/pytest-parameterize-support branch from f3b259c to a83fe7b Compare May 21, 2026 22:16
@alexluck-sift alexluck-sift changed the title Python(feat): pytest parameterize support Python(feat): hierarchical pytest report tree (packages, modules, classes, parametrize) May 22, 2026
@alexluck-sift alexluck-sift marked this pull request as ready for review May 23, 2026 00:41
@alexluck-sift alexluck-sift merged commit 1187fc6 into al/python/feat/pytest-dev-branch May 23, 2026
18 checks passed
@alexluck-sift alexluck-sift deleted the al/python/feat/pytest-parameterize-support branch May 23, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants