python(fix): teardown failure on the last test, and combined parametrize axis nesting - #691
Merged
Merged
Conversation
Contributor
|
Python docs preview: https://sift-stack.github.io/sift/python/pr-691/ Deployed from |
StatusWrites is a module-level alias, so it is evaluated at runtime and builtin generics are not subscriptable before 3.9. Spell it with typing.List/Tuple. Four new tests reused the inner module and function name test_comb. steps.parametrize_parents is a module-global keyed by nodeid and its reset fixture is opt-in, so identical keys collided across tests once the order was shuffled. Give each a unique name, and assert the ancestor chain over every leaf rather than a fixed index.
ian-sift
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent fixes to the pytest plugin's report tree.
Teardown failure on the last test was never uploaded. pytest tears down the session-scoped
report_contextfixture during the final item's teardown phase but reports that outcome afterwards, so the report status was computed before the failure was known and its log entry was written after the import worker stopped reading. A run whose last test failed in teardown showed fully green.finalizeis now split out of__exit__and deferred via a constructor flag, so the plugin calls it frompytest_sessionfinish. Late failures also propagate up the ancestor chain, correcting already-closed ancestors from PASSED to FAILED.Combined parametrize axes nested once per argname.
@pytest.mark.parametrize("a,b,c", cases, ids=NAMES)is one axis in pytest, but the plugin rendered one step per argname and discardedids=, so function-object values produced labels carrying heap addresses. Axes are now grouped by their mark: one axis, one step, labelled with its ID. This changes step names and tree depth, so reports from before and after will not group together.182 tests passing in
_tests/pytest_plugin, up from 177. Both fixes have regression tests verified to fail against the pre-fix code. One existing test asserted the old per-argname behavior and was replaced.