summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2019-04-09 16:14:42 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2019-04-09 16:14:42 +0300
commitaf24e4dec453af7e3dcb45347cb59bfcbc037843 (patch)
tree91c79759ac13e3b43f9856f1394217eef2feca81
parent7b839bf5da772d4bf61a3be95fbdbb6d4591ba63 (diff)
downloadunit-af24e4dec453af7e3dcb45347cb59bfcbc037843.tar.gz
unit-af24e4dec453af7e3dcb45347cb59bfcbc037843.tar.bz2
Tests: simplified module checking.
-rw-r--r--test/test_access_log.py3
-rw-r--r--test/test_configuration.py3
-rw-r--r--test/test_go_application.py3
-rw-r--r--test/test_http_header.py3
-rw-r--r--test/test_java_application.py3
-rw-r--r--test/test_node_application.py3
-rw-r--r--test/test_perl_application.py3
-rw-r--r--test/test_php_application.py3
-rw-r--r--test/test_php_basic.py3
-rw-r--r--test/test_python_application.py3
-rw-r--r--test/test_python_basic.py3
-rw-r--r--test/test_python_environment.py3
-rw-r--r--test/test_python_procman.py3
-rw-r--r--test/test_routing.py3
-rw-r--r--test/test_ruby_application.py3
-rw-r--r--test/test_settings.py3
-rw-r--r--test/test_tls.py4
-rw-r--r--test/unit/main.py4
18 files changed, 21 insertions, 35 deletions
diff --git a/test/test_access_log.py b/test/test_access_log.py
index c58ee26f..1c8c29d7 100644
--- a/test/test_access_log.py
+++ b/test/test_access_log.py
@@ -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)
diff --git a/test/test_configuration.py b/test/test_configuration.py
index eb56a548..74596ed8 100644
--- a/test/test_configuration.py
+++ b/test/test_configuration.py
@@ -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')
diff --git a/test/test_go_application.py b/test/test_go_application.py
index 8c06d583..0f66a730 100644
--- a/test/test_go_application.py
+++ b/test/test_go_application.py
@@ -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')
diff --git a/test/test_http_header.py b/test/test_http_header.py
index d14514e2..f4449ea0 100644
--- a/test/test_http_header.py
+++ b/test/test_http_header.py
@@ -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')
diff --git a/test/test_java_application.py b/test/test_java_application.py
index 71098711..18538f57 100644
--- a/test/test_java_application.py
+++ b/test/test_java_application.py
@@ -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')
diff --git a/test/test_node_application.py b/test/test_node_application.py
index 242b0555..c55e4fde 100644
--- a/test/test_node_application.py
+++ b/test/test_node_application.py
@@ -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')
diff --git a/test/test_perl_application.py b/test/test_perl_application.py
index 521a227c..00d4a3e5 100644
--- a/test/test_perl_application.py
+++ b/test/test_perl_application.py
@@ -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')
diff --git a/test/test_php_application.py b/test/test_php_application.py
index 6c7f7f4b..7e75a73d 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -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']
diff --git a/test/test_php_basic.py b/test/test_php_basic.py
index 0e8caacf..d579afee 100644
--- a/test/test_php_basic.py
+++ b/test/test_php_basic.py
@@ -2,8 +2,7 @@ from unit.control import TestControl
class TestPHPBasic(TestControl):
- def setUpClass():
- TestControl().check_modules('php')
+ prerequisites = ['php']
conf_app = {
"app": {
diff --git a/test/test_python_application.py b/test/test_python_application.py
index 6c65e3b7..7f435509 100644
--- a/test/test_python_application.py
+++ b/test/test_python_application.py
@@ -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')
diff --git a/test/test_python_basic.py b/test/test_python_basic.py
index 1869103f..c425718d 100644
--- a/test/test_python_basic.py
+++ b/test/test_python_basic.py
@@ -2,8 +2,7 @@ from unit.control import TestControl
class TestPythonBasic(TestControl):
- def setUpClass():
- TestControl().check_modules('python')
+ prerequisites = ['python']
conf_app = {
"app": {
diff --git a/test/test_python_environment.py b/test/test_python_environment.py
index 8debadda..744f4947 100644
--- a/test/test_python_environment.py
+++ b/test/test_python_environment.py
@@ -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')
diff --git a/test/test_python_procman.py b/test/test_python_procman.py
index 461846e3..9292adcb 100644
--- a/test/test_python_procman.py
+++ b/test/test_python_procman.py
@@ -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)
diff --git a/test/test_routing.py b/test/test_routing.py
index bc84dd6f..63a7dc6c 100644
--- a/test/test_routing.py
+++ b/test/test_routing.py
@@ -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()
diff --git a/test/test_ruby_application.py b/test/test_ruby_application.py
index 7e12ef83..e119127f 100644
--- a/test/test_ruby_application.py
+++ b/test/test_ruby_application.py
@@ -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')
diff --git a/test/test_settings.py b/test/test_settings.py
index b34883b8..4e604f21 100644
--- a/test/test_settings.py
+++ b/test/test_settings.py
@@ -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')
diff --git a/test/test_tls.py b/test/test_tls.py
index 954387d7..f9b0a978 100644
--- a/test/test_tls.py
+++ b/test/test_tls.py
@@ -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:
diff --git a/test/unit/main.py b/test/unit/main.py
index 247f3fbf..2ab0626b 100644
--- a/test/unit/main.py
+++ b/test/unit/main.py
@@ -47,6 +47,10 @@ class TestUnit(unittest.TestCase):
unittest.main()
+ @classmethod
+ def setUpClass(cls):
+ TestUnit().check_modules(*cls.prerequisites)
+
def setUp(self):
self._run()