Skip to content

Commit a7230ea

Browse files
authored
Merge branch 'master' into assert-CallerInfo-cleanup-stackFrameBufferSize
2 parents ffa3a05 + b50b016 commit a7230ea

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

suite/suite.go

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ func Run(t *testing.T, suite TestingSuite) {
128128
suite.SetT(t)
129129
suite.SetS(suite)
130130

131-
var suiteSetupDone bool
132-
133131
var stats *SuiteInformation
134132
if _, ok := suite.(WithStats); ok {
135133
stats = newSuiteInformation()
@@ -152,18 +150,6 @@ func Run(t *testing.T, suite TestingSuite) {
152150
continue
153151
}
154152

155-
if !suiteSetupDone {
156-
if stats != nil {
157-
stats.Start = time.Now()
158-
}
159-
160-
if setupAllSuite, ok := suite.(SetupAllSuite); ok {
161-
setupAllSuite.SetupSuite()
162-
}
163-
164-
suiteSetupDone = true
165-
}
166-
167153
test := test{
168154
name: method.Name,
169155
run: func(t *testing.T) {
@@ -208,19 +194,30 @@ func Run(t *testing.T, suite TestingSuite) {
208194
}
209195
tests = append(tests, test)
210196
}
211-
if suiteSetupDone {
212-
defer func() {
213-
if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok {
214-
tearDownAllSuite.TearDownSuite()
215-
}
216-
217-
if suiteWithStats, measureStats := suite.(WithStats); measureStats {
218-
stats.End = time.Now()
219-
suiteWithStats.HandleStats(suiteName, stats)
220-
}
221-
}()
197+
198+
if len(tests) == 0 {
199+
return
200+
}
201+
202+
if stats != nil {
203+
stats.Start = time.Now()
204+
}
205+
206+
if setupAllSuite, ok := suite.(SetupAllSuite); ok {
207+
setupAllSuite.SetupSuite()
222208
}
223209

210+
defer func() {
211+
if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok {
212+
tearDownAllSuite.TearDownSuite()
213+
}
214+
215+
if suiteWithStats, measureStats := suite.(WithStats); measureStats {
216+
stats.End = time.Now()
217+
suiteWithStats.HandleStats(suiteName, stats)
218+
}
219+
}()
220+
224221
runTests(t, tests)
225222
}
226223

0 commit comments

Comments
 (0)