Skip to content

Commit 2dc8c61

Browse files
Skip tests that require openai key
1 parent 4dace5c commit 2dc8c61

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/test/examples_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const (
1717
)
1818

1919
func TestExamples(t *testing.T) {
20+
RequireOpenAPIKey(t)
21+
2022
tests := []string{
2123
"fib.gpt",
2224
"helloworld.gpt",
@@ -38,6 +40,8 @@ func TestExamples(t *testing.T) {
3840
}
3941

4042
func TestEcho(t *testing.T) {
43+
RequireOpenAPIKey(t)
44+
4145
r, err := runner.New()
4246
require.NoError(t, err)
4347

@@ -49,3 +53,9 @@ func TestEcho(t *testing.T) {
4953

5054
autogold.ExpectFile(t, output)
5155
}
56+
57+
func RequireOpenAPIKey(t *testing.T) {
58+
if os.Getenv("OPENAI_API_KEY") == "" {
59+
t.Skip()
60+
}
61+
}

0 commit comments

Comments
 (0)