Defer suite teardown to align with test teardown

pull/97/head
Jon Gjengset 2014-11-25 19:58:50 -05:00
parent 576f6382c0
commit 81a69ed105
1 changed files with 5 additions and 4 deletions

View File

@ -39,6 +39,11 @@ func Run(t *testing.T, suite TestingSuite) {
if setupAllSuite, ok := suite.(SetupAllSuite); ok {
setupAllSuite.SetupSuite()
}
defer func() {
if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok {
tearDownAllSuite.TearDownSuite()
}
}()
methodFinder := reflect.TypeOf(suite)
tests := []testing.InternalTest{}
@ -75,10 +80,6 @@ func Run(t *testing.T, suite TestingSuite) {
tests) {
t.Fail()
}
if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok {
tearDownAllSuite.TearDownSuite()
}
}
// Filtering method according to set regular expression