diff --git a/audio/audio_test.go b/audio/audio_test.go index f87e804cc..6aa0c95a3 100644 --- a/audio/audio_test.go +++ b/audio/audio_test.go @@ -16,6 +16,7 @@ package audio_test import ( "bytes" + "os" "runtime" "testing" "time" @@ -34,6 +35,14 @@ func teardown() { context = nil } +func TestMain(m *testing.M) { + code := m.Run() + // 200[ms] should be enough all the players are consumed. + // TODO: This is a dirty hack. Would it be possible to use virtual time? + time.Sleep(200 * time.Millisecond) + os.Exit(code) +} + // Issue #746 func TestGC(t *testing.T) { setup() @@ -138,8 +147,4 @@ func TestNonSeekableSource(t *testing.T) { p.Play() p.Pause() - - // 200[ms] should be enough all the bytes are consumed. - // TODO: This is a dirty hack. Would it be possible to use virtual time? - time.Sleep(200 * time.Millisecond) }