summaryrefslogtreecommitdiffhomepage
path: root/test/unit/applications/lang/go.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2020-09-16 21:31:15 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2020-09-16 21:31:15 +0100
commitd5e915934066c77a59d211efafca10c117b73d05 (patch)
treef894a3c09bd8aa43e87276eed377eb09f97e46fe /test/unit/applications/lang/go.py
parent77ecb6ab49257dd662aa9c461fed3dc1d74e5092 (diff)
downloadunit-d5e915934066c77a59d211efafca10c117b73d05.tar.gz
unit-d5e915934066c77a59d211efafca10c117b73d05.tar.bz2
Tests: migrated to the pytest.
Diffstat (limited to '')
-rw-r--r--test/unit/applications/lang/go.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py
index 83bde4d8..069bdecb 100644
--- a/test/unit/applications/lang/go.py
+++ b/test/unit/applications/lang/go.py
@@ -2,17 +2,18 @@ import os
import subprocess
from unit.applications.proto import TestApplicationProto
+from conftest import option
class TestApplicationGo(TestApplicationProto):
@classmethod
- def setUpClass(cls, complete_check=True):
- unit = super().setUpClass(complete_check=False)
+ def setup_class(cls, complete_check=True):
+ unit = super().setup_class(complete_check=False)
# check go module
go_app = TestApplicationGo()
- go_app.testdir = unit.testdir
+ go_app.temp_dir = unit.temp_dir
proc = go_app.prepare_env('empty', 'app')
if proc and proc.returncode == 0:
cls.available['modules']['go'] = []
@@ -20,8 +21,8 @@ class TestApplicationGo(TestApplicationProto):
return unit if not complete_check else unit.complete()
def prepare_env(self, script, name, static=False):
- if not os.path.exists(self.testdir + '/go'):
- os.mkdir(self.testdir + '/go')
+ if not os.path.exists(self.temp_dir + '/go'):
+ os.mkdir(self.temp_dir + '/go')
env = os.environ.copy()
env['GOPATH'] = self.pardir + '/build/go'
@@ -35,16 +36,16 @@ class TestApplicationGo(TestApplicationProto):
'-ldflags',
'-extldflags "-static"',
'-o',
- self.testdir + '/go/' + name,
- self.current_dir + '/go/' + script + '/' + name + '.go',
+ self.temp_dir + '/go/' + name,
+ option.test_dir + '/go/' + script + '/' + name + '.go',
]
else:
args = [
'go',
'build',
'-o',
- self.testdir + '/go/' + name,
- self.current_dir + '/go/' + script + '/' + name + '.go',
+ self.temp_dir + '/go/' + name,
+ option.test_dir + '/go/' + script + '/' + name + '.go',
]
try:
@@ -59,8 +60,8 @@ class TestApplicationGo(TestApplicationProto):
def load(self, script, name='app', **kwargs):
static_build = False
- wdir = self.current_dir + "/go/" + script
- executable = self.testdir + "/go/" + name
+ wdir = option.test_dir + "/go/" + script
+ executable = self.temp_dir + "/go/" + name
if 'isolation' in kwargs and 'rootfs' in kwargs['isolation']:
wdir = "/go/"