suite: fix panic if a WithStats suite skips a test early #1802
Open
segogoreng wants to merge 3 commits intostretchr:masterfrom
Open
suite: fix panic if a WithStats suite skips a test early #1802segogoreng wants to merge 3 commits intostretchr:masterfrom
segogoreng wants to merge 3 commits intostretchr:masterfrom
Conversation
segogoreng
commented
Sep 23, 2025
suite/suite_stats_and_skip_test.go
Outdated
Author
There was a problem hiding this comment.
Do we need a new test file for this?
I feel like we can put this in the existing test file.
Collaborator
There was a problem hiding this comment.
I think so too. You might also find there's an existing substitute for mySuite.
Author
There was a problem hiding this comment.
Moved the test to suite/suite_test.go and renamed mySuite to a more descriptive suiteSkipTestWithStats
Author
There was a problem hiding this comment.
Hi @brackendawson, could you take a look at this, please?
a92f108 to
f947962
Compare
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.
Summary
Continues work from #1723 by @FGasper .
This PR rebases with the latest master.
This fixes issue #1722.
Changes
Prevent stats.end() if stats.start() never ran.
Motivation
Allow skipping a test in a setup/before hook. See issue #1722 for an example.
Related issues
Closes #1722