Tests: redirect tests output to the stdout.

This commit is contained in:
Andrei Zeliankou
2020-03-10 18:10:42 +00:00
parent 810b8dbb67
commit f36f0f2461
6 changed files with 20 additions and 13 deletions

View File

@@ -12,7 +12,7 @@ if __name__ == '__main__':
tests = loader.discover(start_dir=this_dir) tests = loader.discover(start_dir=this_dir)
suite.addTests(tests) suite.addTests(tests)
runner = unittest.TextTestRunner(verbosity=3) runner = unittest.TextTestRunner(stream=sys.stdout, verbosity=3)
result = runner.run(suite) result = runner.run(suite)
ret = not (len(result.failures) == len(result.errors) == 0) ret = not (len(result.failures) == len(result.errors) == 0)

View File

@@ -2,7 +2,6 @@ import os
import re import re
import time import time
import unittest import unittest
from subprocess import call
from unit.applications.lang.python import TestApplicationPython from unit.applications.lang.python import TestApplicationPython

View File

@@ -157,7 +157,8 @@ class TestTLS(TestApplicationTLS):
'-genkey', '-genkey',
'-out', self.testdir + '/ec.key', '-out', self.testdir + '/ec.key',
'-name', 'prime256v1', '-name', 'prime256v1',
] ],
stderr=subprocess.STDOUT,
) )
subprocess.call( subprocess.call(
@@ -170,7 +171,8 @@ class TestTLS(TestApplicationTLS):
'-config', self.testdir + '/openssl.conf', '-config', self.testdir + '/openssl.conf',
'-key', self.testdir + '/ec.key', '-key', self.testdir + '/ec.key',
'-out', self.testdir + '/ec.crt', '-out', self.testdir + '/ec.crt',
] ],
stderr=subprocess.STDOUT,
) )
self.certificate_load('ec') self.certificate_load('ec')
@@ -230,7 +232,8 @@ class TestTLS(TestApplicationTLS):
'-config', self.testdir + '/openssl.conf', '-config', self.testdir + '/openssl.conf',
'-out', self.testdir + '/int.csr', '-out', self.testdir + '/int.csr',
'-keyout', self.testdir + '/int.key', '-keyout', self.testdir + '/int.key',
] ],
stderr=subprocess.STDOUT,
) )
subprocess.call( subprocess.call(
@@ -242,7 +245,8 @@ class TestTLS(TestApplicationTLS):
'-config', self.testdir + '/openssl.conf', '-config', self.testdir + '/openssl.conf',
'-out', self.testdir + '/end.csr', '-out', self.testdir + '/end.csr',
'-keyout', self.testdir + '/end.key', '-keyout', self.testdir + '/end.key',
] ],
stderr=subprocess.STDOUT,
) )
with open(self.testdir + '/ca.conf', 'w') as f: with open(self.testdir + '/ca.conf', 'w') as f:
@@ -288,7 +292,8 @@ basicConstraints = critical,CA:TRUE"""
'-cert', self.testdir + '/root.crt', '-cert', self.testdir + '/root.crt',
'-in', self.testdir + '/int.csr', '-in', self.testdir + '/int.csr',
'-out', self.testdir + '/int.crt', '-out', self.testdir + '/int.crt',
] ],
stderr=subprocess.STDOUT,
) )
subprocess.call( subprocess.call(
@@ -302,7 +307,8 @@ basicConstraints = critical,CA:TRUE"""
'-cert', self.testdir + '/int.crt', '-cert', self.testdir + '/int.crt',
'-in', self.testdir + '/end.csr', '-in', self.testdir + '/end.csr',
'-out', self.testdir + '/end.crt', '-out', self.testdir + '/end.crt',
] ],
stderr=subprocess.STDOUT,
) )
crt_path = self.testdir + '/end-int.crt' crt_path = self.testdir + '/end-int.crt'

View File

@@ -1,5 +1,5 @@
import os import os
from subprocess import Popen import subprocess
from unit.applications.proto import TestApplicationProto from unit.applications.proto import TestApplicationProto
@@ -26,7 +26,7 @@ class TestApplicationGo(TestApplicationProto):
env['GOPATH'] = self.pardir + '/build/go' env['GOPATH'] = self.pardir + '/build/go'
try: try:
process = Popen( process = subprocess.Popen(
[ [
'go', 'go',
'build', 'build',
@@ -35,6 +35,7 @@ class TestApplicationGo(TestApplicationProto):
self.current_dir + '/go/' + script + '/' + name + '.go', self.current_dir + '/go/' + script + '/' + name + '.go',
], ],
env=env, env=env,
stderr=subprocess.STDOUT,
) )
process.communicate() process.communicate()

View File

@@ -1,7 +1,7 @@
import os import os
import glob import glob
import shutil import shutil
from subprocess import Popen import subprocess
from unit.applications.proto import TestApplicationProto from unit.applications.proto import TestApplicationProto
@@ -64,7 +64,7 @@ class TestApplicationJava(TestApplicationProto):
javac.extend(src) javac.extend(src)
try: try:
process = Popen(javac) process = subprocess.Popen(javac, stderr=subprocess.STDOUT)
process.communicate() process.communicate()
except: except:

View File

@@ -47,7 +47,8 @@ class TestApplicationTLS(TestApplicationProto):
'-config', self.testdir + '/openssl.conf', '-config', self.testdir + '/openssl.conf',
'-out', self.testdir + '/' + name + '.crt', '-out', self.testdir + '/' + name + '.crt',
'-keyout', self.testdir + '/' + name + '.key', '-keyout', self.testdir + '/' + name + '.key',
] ],
stderr=subprocess.STDOUT,
) )
if load: if load: