Tests: simplified module checking.

This commit is contained in:
Andrey Zelenkov
2019-04-09 16:14:42 +03:00
parent 7b839bf5da
commit af24e4dec4
18 changed files with 21 additions and 35 deletions

View File

@@ -6,8 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestAccessLog(TestApplicationPython):
def setUpClass():
TestApplicationPython().check_modules('python')
prerequisites = ['python']
def load(self, script):
super().load(script)

View File

@@ -3,8 +3,7 @@ from unit.control import TestControl
class TestConfiguration(TestControl):
def setUpClass():
TestControl().check_modules('python')
prerequisites = ['python']
def test_json_empty(self):
self.assertIn('error', self.conf(''), 'empty')

View File

@@ -3,8 +3,7 @@ from unit.applications.lang.go import TestApplicationGo
class TestGoApplication(TestApplicationGo):
def setUpClass():
TestApplicationGo().check_modules('go')
prerequisites = ['go']
def test_go_application_variables(self):
self.load('variables')

View File

@@ -2,8 +2,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestHTTPHeader(TestApplicationPython):
def setUpClass():
TestApplicationPython().check_modules('python')
prerequisites = ['python']
def test_http_header_value_leading_sp(self):
self.load('custom_header')

View File

@@ -3,8 +3,7 @@ from unit.applications.lang.java import TestApplicationJava
class TestJavaApplication(TestApplicationJava):
def setUpClass():
TestApplicationJava().check_modules('java')
prerequisites = ['java']
def test_java_application_cookies(self):
self.load('cookies')

View File

@@ -3,8 +3,7 @@ from unit.applications.lang.node import TestApplicationNode
class TestNodeApplication(TestApplicationNode):
def setUpClass():
TestApplicationNode().check_modules('node')
prerequisites = ['node']
def test_node_application_basic(self):
self.load('basic')

View File

@@ -3,8 +3,7 @@ from unit.applications.lang.perl import TestApplicationPerl
class TestPerlApplication(TestApplicationPerl):
def setUpClass():
TestApplicationPerl().check_modules('perl')
prerequisites = ['perl']
def test_perl_application(self):
self.load('variables')

View File

@@ -3,8 +3,7 @@ import unittest
from unit.applications.lang.php import TestApplicationPHP
class TestPHPApplication(TestApplicationPHP):
def setUpClass():
TestApplicationPHP().check_modules('php')
prerequisites = ['php']
def before_disable_functions(self):
body = self.get()['body']

View File

@@ -2,8 +2,7 @@ from unit.control import TestControl
class TestPHPBasic(TestControl):
def setUpClass():
TestControl().check_modules('php')
prerequisites = ['php']
conf_app = {
"app": {

View File

@@ -4,8 +4,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestPythonApplication(TestApplicationPython):
def setUpClass():
TestApplicationPython().check_modules('python')
prerequisites = ['python']
def test_python_application_variables(self):
self.load('variables')

View File

@@ -2,8 +2,7 @@ from unit.control import TestControl
class TestPythonBasic(TestControl):
def setUpClass():
TestControl().check_modules('python')
prerequisites = ['python']
conf_app = {
"app": {

View File

@@ -2,8 +2,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestPythonEnvironment(TestApplicationPython):
def setUpClass():
TestApplicationPython().check_modules('python')
prerequisites = ['python']
def test_python_environment_name_null(self):
self.load('environment')

View File

@@ -6,8 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestPythonProcman(TestApplicationPython):
def setUpClass():
TestApplicationPython().check_modules('python')
prerequisites = ['python']
def pids_for_process(self):
time.sleep(0.2)

View File

@@ -2,8 +2,7 @@ from unit.applications.proto import TestApplicationProto
class TestRouting(TestApplicationProto):
def setUpClass():
TestApplicationProto().check_modules('python')
prerequisites = ['python']
def setUp(self):
super().setUp()

View File

@@ -3,8 +3,7 @@ from unit.applications.lang.ruby import TestApplicationRuby
class TestRubyApplication(TestApplicationRuby):
def setUpClass():
TestApplicationRuby().check_modules('ruby')
prerequisites = ['ruby']
def test_ruby_application(self):
self.load('variables')

View File

@@ -5,8 +5,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestSettings(TestApplicationPython):
def setUpClass():
TestApplicationPython().check_modules('python')
prerequisites = ['python']
def test_settings_header_read_timeout(self):
self.load('empty')

View File

@@ -4,12 +4,10 @@ import time
import subprocess
import unittest
from unit.applications.tls import TestApplicationTLS
from unit.main import TestUnit
class TestTLS(TestApplicationTLS):
def setUpClass():
TestUnit().check_modules('python', 'openssl')
prerequisites = ['python', 'openssl']
def findall(self, pattern):
with open(self.testdir + '/unit.log', 'r', errors='ignore') as f:

View File

@@ -47,6 +47,10 @@ class TestUnit(unittest.TestCase):
unittest.main()
@classmethod
def setUpClass(cls):
TestUnit().check_modules(*cls.prerequisites)
def setUp(self):
self._run()