diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-09-25 19:21:42 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-09-25 19:21:42 +0300 |
commit | d82f125368d7d19300789ddd41587c09ffdcf36a (patch) | |
tree | a3b690f11c898cd7c9674327400ebae1fca0158a /test/unit/applications/lang/go.py | |
parent | 5c6b01d76c329f4ddcc31378e4ec62123e804d01 (diff) | |
download | unit-d82f125368d7d19300789ddd41587c09ffdcf36a.tar.gz unit-d82f125368d7d19300789ddd41587c09ffdcf36a.tar.bz2 |
Tests: fixed hanging of Go tests.
This closes #319 issue on GitHub.
Diffstat (limited to 'test/unit/applications/lang/go.py')
-rw-r--r-- | test/unit/applications/lang/go.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py index 15ac1cd9..18345828 100644 --- a/test/unit/applications/lang/go.py +++ b/test/unit/applications/lang/go.py @@ -12,7 +12,8 @@ class TestApplicationGo(TestApplicationProto): go_app = TestApplicationGo() go_app.testdir = unit.testdir - if go_app.prepare_env('empty', 'app').returncode == 0: + 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() @@ -23,18 +24,23 @@ class TestApplicationGo(TestApplicationProto): env = os.environ.copy() env['GOPATH'] = self.pardir + '/go' - process = Popen( - [ - 'go', - 'build', - '-o', - self.testdir + '/go/' + name, - self.current_dir + '/go/' + script + '/' + name + '.go', - ], - env=env, - ) - process.communicate() + try: + process = Popen( + [ + 'go', + 'build', + '-o', + self.testdir + '/go/' + name, + self.current_dir + '/go/' + script + '/' + name + '.go', + ], + env=env, + ) + + process.communicate() + + except: + return None return process |