From d5e915934066c77a59d211efafca10c117b73d05 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Wed, 16 Sep 2020 21:31:15 +0100 Subject: Tests: migrated to the pytest. --- test/unit/applications/lang/go.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'test/unit/applications/lang/go.py') 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/" -- cgit From d491527555c076695a4202577198e12bf0b919ec Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Thu, 1 Oct 2020 10:17:00 +0100 Subject: Tests: minor fixes. Fixed temporary dir removing. Fixed printing path to log. Module checks moved to the separate file. --- test/unit/applications/lang/go.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'test/unit/applications/lang/go.py') diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py index 069bdecb..946b5421 100644 --- a/test/unit/applications/lang/go.py +++ b/test/unit/applications/lang/go.py @@ -6,26 +6,12 @@ from conftest import option class TestApplicationGo(TestApplicationProto): - @classmethod - def setup_class(cls, complete_check=True): - unit = super().setup_class(complete_check=False) - - # check go module - - go_app = TestApplicationGo() - go_app.temp_dir = unit.temp_dir - proc = go_app.prepare_env('empty', 'app') - if proc and proc.returncode == 0: - cls.available['modules']['go'] = [] - - return unit if not complete_check else unit.complete() - def prepare_env(self, script, name, static=False): 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' + env['GOPATH'] = option.current_dir + '/build/go' if static: args = [ -- cgit From 6ec0ff35964c7805712d978625949f72ff5a63bc Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Wed, 7 Oct 2020 23:18:43 +0100 Subject: Tests: minor fixes. --- test/unit/applications/lang/go.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/applications/lang/go.py') diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py index 946b5421..7715bd6c 100644 --- a/test/unit/applications/lang/go.py +++ b/test/unit/applications/lang/go.py @@ -1,8 +1,8 @@ import os import subprocess -from unit.applications.proto import TestApplicationProto from conftest import option +from unit.applications.proto import TestApplicationProto class TestApplicationGo(TestApplicationProto): -- cgit