summaryrefslogtreecommitdiffhomepage
path: root/test/unit/check/go.py
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2022-01-10 16:07:31 +0300
committerMax Romanov <max.romanov@nginx.com>2022-01-10 16:07:31 +0300
commit1297e8a16a2fb0ccc195c0dd14b678bb2d7fc9fc (patch)
treea1ea5a3eb322bd8f3e8c6f222dcb7c076e11339c /test/unit/check/go.py
parent818a78d82cd9aeb6c7429ef97cd1f39f9053b909 (diff)
downloadunit-1297e8a16a2fb0ccc195c0dd14b678bb2d7fc9fc.tar.gz
unit-1297e8a16a2fb0ccc195c0dd14b678bb2d7fc9fc.tar.bz2
Tests: using modules in Go.
Diffstat (limited to '')
-rw-r--r--test/unit/check/go.py36
1 files changed, 5 insertions, 31 deletions
diff --git a/test/unit/check/go.py b/test/unit/check/go.py
index cc17f0fe..3d9d13e7 100644
--- a/test/unit/check/go.py
+++ b/test/unit/check/go.py
@@ -1,34 +1,8 @@
-import os
-import subprocess
+from unit.applications.lang.go import TestApplicationGo
-def check_go(current_dir, temp_dir, test_dir):
- if not os.path.exists(temp_dir + '/go'):
- os.mkdir(temp_dir + '/go')
+def check_go():
+ process = TestApplicationGo.prepare_env('empty')
- env = os.environ.copy()
- env['GOPATH'] = current_dir + '/build/go'
- env['GO111MODULE'] = 'auto'
-
- try:
- process = subprocess.run(
- [
- 'go',
- 'build',
- '-o',
- temp_dir + '/go/app',
- test_dir + '/go/empty/app.go',
- ],
- env=env,
- stderr=subprocess.STDOUT,
- stdout=subprocess.PIPE,
- )
-
- if process.returncode == 0:
- return True
-
- except KeyboardInterrupt:
- raise
-
- except subprocess.CalledProcessError:
- return None
+ if process != None and process.returncode == 0:
+ return True