Skip to content

Commit f7262b7

Browse files
authored
Merge pull request #16184 from github/mbg/go/integration-tests-lib
Go: Add integration test library
2 parents 3c12863 + 9c26cdd commit f7262b7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
from create_database_utils import *
3+
from diagnostics_test_utils import *
4+
5+
def go_integration_test(source = "src"):
6+
# Set up a GOPATH relative to this test's root directory;
7+
# we set os.environ instead of using extra_env because we
8+
# need it to be set for the call to "go clean -modcache" later
9+
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
10+
os.environ['GOPATH'] = goPath
11+
12+
run_codeql_database_create([], lang="go", source=source)
13+
14+
check_diagnostics()
15+
16+
# Clean up the temporary GOPATH to prevent Bazel failures next
17+
# time the tests are run; see https://github.com/golang/go/issues/27161
18+
subprocess.call(["go", "clean", "-modcache"])

0 commit comments

Comments
 (0)