go.py (1596:b7e2d4d92624) go.py (1621:275b26bbd3ae)
1import os
2import subprocess
3
4from unit.applications.proto import TestApplicationProto
5from conftest import option
6
7
8class TestApplicationGo(TestApplicationProto):
1import os
2import subprocess
3
4from unit.applications.proto import TestApplicationProto
5from conftest import option
6
7
8class TestApplicationGo(TestApplicationProto):
9 @classmethod
10 def setup_class(cls, complete_check=True):
11 unit = super().setup_class(complete_check=False)
12
13 # check go module
14
15 go_app = TestApplicationGo()
16 go_app.temp_dir = unit.temp_dir
17 proc = go_app.prepare_env('empty', 'app')
18 if proc and proc.returncode == 0:
19 cls.available['modules']['go'] = []
20
21 return unit if not complete_check else unit.complete()
22
23 def prepare_env(self, script, name, static=False):
24 if not os.path.exists(self.temp_dir + '/go'):
25 os.mkdir(self.temp_dir + '/go')
26
27 env = os.environ.copy()
9 def prepare_env(self, script, name, static=False):
10 if not os.path.exists(self.temp_dir + '/go'):
11 os.mkdir(self.temp_dir + '/go')
12
13 env = os.environ.copy()
28 env['GOPATH'] = self.pardir + '/build/go'
14 env['GOPATH'] = option.current_dir + '/build/go'
29
30 if static:
31 args = [
32 'go',
33 'build',
34 '-tags',
35 'netgo',
36 '-ldflags',

--- 49 unchanged lines hidden ---
15
16 if static:
17 args = [
18 'go',
19 'build',
20 '-tags',
21 'netgo',
22 '-ldflags',

--- 49 unchanged lines hidden ---