diff --git a/devices/bmxx80/bmx280_test.go b/devices/bmxx80/bmx280_test.go index 4007bb1..ec89e74 100644 --- a/devices/bmxx80/bmx280_test.go +++ b/devices/bmxx80/bmx280_test.go @@ -6,6 +6,7 @@ package bmxx80 import ( "errors" + "flag" "io/ioutil" "log" "os" @@ -610,10 +611,6 @@ func TestI2CSenseContinuous280_command_fail(t *testing.T) { } func TestI2CSenseContinuous280_sense_fail(t *testing.T) { - if !testing.Verbose() { - log.SetOutput(ioutil.Discard) - defer log.SetOutput(os.Stderr) - } bus := i2ctest.Playback{ Ops: []i2ctest.IO{ // Chip ID detection. @@ -1027,3 +1024,11 @@ type spiFail struct { func (s *spiFail) Connect(f physic.Frequency, mode spi.Mode, bits int) (spi.Conn, error) { return nil, errors.New("failing") } + +func TestMain(m *testing.M) { + flag.Parse() + if !testing.Verbose() { + log.SetOutput(ioutil.Discard) + } + os.Exit(m.Run()) +} diff --git a/devices/cap1xxx/cap1xxx_test.go b/devices/cap1xxx/cap1xxx_test.go index 0745db9..3cda2e5 100644 --- a/devices/cap1xxx/cap1xxx_test.go +++ b/devices/cap1xxx/cap1xxx_test.go @@ -8,6 +8,7 @@ import ( "flag" "io/ioutil" "log" + "os" "reflect" "testing" "time" @@ -230,8 +231,12 @@ func setupPlaybackIO() []i2ctest.IO { func init() { sleep = func(time.Duration) {} +} + +func TestMain(m *testing.M) { flag.Parse() if !testing.Verbose() { log.SetOutput(ioutil.Discard) } + os.Exit(m.Run()) }