[load] Skip tests on non-implemented platforms #446

pull/928/head
Lomanic 5 years ago
parent 8110480793
commit 78a65a67a9

@ -3,10 +3,19 @@ package load
import ( import (
"fmt" "fmt"
"testing" "testing"
"github.com/shirou/gopsutil/internal/common"
) )
func skipIfNotImplementedErr(t *testing.T, err error) {
if err == common.ErrNotImplementedError {
t.Skip("not implemented")
}
}
func TestLoad(t *testing.T) { func TestLoad(t *testing.T) {
v, err := Avg() v, err := Avg()
skipIfNotImplementedErr(t, err)
if err != nil { if err != nil {
t.Errorf("error %v", err) t.Errorf("error %v", err)
} }
@ -33,6 +42,7 @@ func TestLoadAvgStat_String(t *testing.T) {
func TestMisc(t *testing.T) { func TestMisc(t *testing.T) {
v, err := Misc() v, err := Misc()
skipIfNotImplementedErr(t, err)
if err != nil { if err != nil {
t.Errorf("error %v", err) t.Errorf("error %v", err)
} }

Loading…
Cancel
Save