MCPcopy Create free account
hub / github.com/cli/cli / runTests

Function runTests

script/ghmock/run_test.go:42–54  ·  view source on GitHub ↗

runTests keeps tests away from the network and the real cache folder. Tests that need schemas call useTestSchemas.

(m *testing.M)

Source from the content-addressed store, hash-verified

40// runTests keeps tests away from the network and the real cache folder. Tests
41// that need schemas call useTestSchemas.
42func runTests(m *testing.M) int {
43 cache, err := os.MkdirTemp("", "ghmock-test-cache-")
44 if err != nil {
45 fmt.Fprintln(os.Stderr, err)
46 return 1
47 }
48 defer os.RemoveAll(cache)
49 userCacheDir = func() (string, error) { return cache, nil }
50 downloadClient = &http.Client{Transport: failingTransport{}}
51 os.Unsetenv(graphQLSource.envVar)
52 os.Unsetenv(restSource.envVar)
53 return m.Run()
54}
55
56type failingTransport struct{}
57

Callers 1

TestMainFunction · 0.85

Calls 1

RunMethod · 0.65

Tested by

no test coverage detected