1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-27 09:12:53 +00:00

*: Ignore examples/voice in integration test

This commit is contained in:
diamondburned 2023-11-04 01:57:31 -07:00
parent 5ebd28bab6
commit ad26a72256
No known key found for this signature in database
GPG key ID: D78C4471CE776659
2 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1 @@
voice

View file

@ -6,12 +6,18 @@ import (
"io" "io"
"os" "os"
"os/exec" "os/exec"
"strings"
"testing" "testing"
"time" "time"
_ "embed"
"github.com/diamondburned/arikawa/v3/internal/testenv" "github.com/diamondburned/arikawa/v3/internal/testenv"
) )
//go:embed integration_exclude.txt
var integrationExclude string
func TestExamples(t *testing.T) { func TestExamples(t *testing.T) {
// Assert that the tests only run when the environment variables are set. // Assert that the tests only run when the environment variables are set.
testenv.Must(t) testenv.Must(t)
@ -22,6 +28,11 @@ func TestExamples(t *testing.T) {
t.Skip("skipping test; go compiler not found") t.Skip("skipping test; go compiler not found")
} }
excluded := make(map[string]bool)
for _, line := range strings.Split(string(integrationExclude), "\n") {
excluded[strings.TrimSpace(line)] = true
}
examplePackages, err := os.ReadDir(".") examplePackages, err := os.ReadDir(".")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
@ -66,6 +77,10 @@ func TestExamples(t *testing.T) {
t.Fatal("cannot go build:", err) t.Fatal("cannot go build:", err)
} }
if excluded[pkg.Name()] {
t.Skip("skipping excluded example", pkg.Name())
}
timer := time.NewTimer(exampleRunDuration) timer := time.NewTimer(exampleRunDuration)
t.Cleanup(func() { timer.Stop() }) t.Cleanup(func() { timer.Stop() })