Write setup_class error record to summary even if on_fail aborts - #1031
Open
hjfreyer wants to merge 1 commit into
Open
Write setup_class error record to summary even if on_fail aborts#1031hjfreyer wants to merge 1 commit into
hjfreyer wants to merge 1 commit into
Conversation
When `setup_class` failed and the user's `on_fail` callback raised an abort signal (e.g. via `asserts.abort_all` or `asserts.abort_class`), the signal propagated out of `_exec_procedure_func` before `update_record()` and `summary_writer.dump()` ran. The error was counted in `self.results` but no corresponding record was ever written to `test_summary.yaml`, producing a summary where the error count did not match the records present. Move the record finalization and dump into a `finally` block around the `on_fail` call, mirroring the pattern already used in `exec_one_test`. This covers both the exception path and the `expects` path; in the latter `test_error()` also moves into the `finally` block so the record is finalized even when `on_fail` aborts. The existing regression test only checked the in-memory results, so it did not catch this. It now also asserts on the summary file contents, and new tests cover the `expects` path and `TestAbortClass`. Fixes google#1029
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.
When
setup_classfailed and the user'son_failcallback raised an abort signal (e.g. viaasserts.abort_allorasserts.abort_class), the signal propagated out of_exec_procedure_funcbeforeupdate_record()andsummary_writer.dump()ran. The error was counted inself.resultsbut no corresponding record was ever written totest_summary.yaml, producing a summary where the error count did not match the records present.Move the record finalization and dump into a
finallyblock around theon_failcall, mirroring the pattern already used inexec_one_test. This covers both the exception path and theexpectspath; in the lattertest_error()also moves into thefinallyblock so the record is finalized even whenon_failaborts.The existing regression test only checked the in-memory results, so it did not catch this. It now also asserts on the summary file contents, and new tests cover the
expectspath andTestAbortClass.Fixes #1029