Tests: minor fixes.

Fixed temporary dir removing.
Fixed printing path to log.
Module checks moved to the separate file.
This commit is contained in:
Andrei Zeliankou
2020-10-01 10:17:00 +01:00
parent 1fe1518ab1
commit d491527555
10 changed files with 89 additions and 76 deletions

29
test/unit/check/go.py Normal file
View File

@@ -0,0 +1,29 @@
import os
import subprocess
def check_go(current_dir, temp_dir, test_dir):
if not os.path.exists(temp_dir + '/go'):
os.mkdir(temp_dir + '/go')
env = os.environ.copy()
env['GOPATH'] = current_dir + '/build/go'
try:
process = subprocess.Popen(
[
'go',
'build',
'-o',
temp_dir + '/go/app',
test_dir + '/go/empty/app.go',
],
env=env,
)
process.communicate()
if process.returncode == 0:
return True
except:
return None

6
test/unit/check/node.py Normal file
View File

@@ -0,0 +1,6 @@
import os
def check_node(current_dir):
if os.path.exists(current_dir + '/node/node_modules'):
return True

13
test/unit/check/tls.py Normal file
View File

@@ -0,0 +1,13 @@
import re
import subprocess
def check_openssl(unitd):
subprocess.check_output(['which', 'openssl'])
output = subprocess.check_output(
[unitd, '--version'], stderr=subprocess.STDOUT
)
if re.search('--openssl', output.decode()):
return True