Skip to content

fix(suite): restore test context after hook panic - #1992

Open
fallintoplace wants to merge 1 commit into
stretchr:masterfrom
fallintoplace:fix/suite-test-context-on-hook-panic
Open

fallintoplace wants to merge 1 commit into
stretchr:masterfrom
fallintoplace:fix/suite-test-context-on-hook-panic

Conversation

@fallintoplace

Copy link
Copy Markdown

What

  • Restore the parent *testing.T after a suite cleanup hook panics.

Why

  • AfterTest and TearDownTest can panic during cleanup. That leaves Suite.T() pointing at the failed child test.

Implementation

  • Defer test-context restoration before cleanup.
  • Cover panics in both hooks.

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.

1 participant