diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2018-02-14 17:14:16 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2018-02-14 17:14:16 +0300 |
commit | ee39da0e00423d2e4f109f90142c3543e819c14d (patch) | |
tree | b08346f2f11f25ed6bc5438eb81795c2666df549 /test | |
parent | 27b00629e1e3af2f8b84aa349351df50f05f3c83 (diff) | |
download | unit-ee39da0e00423d2e4f109f90142c3543e819c14d.tar.gz unit-ee39da0e00423d2e4f109f90142c3543e819c14d.tar.bz2 |
Tests: removed unused code in unit.py.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_configuration.py | 5 | ||||
-rw-r--r-- | test/test_php_basic.py | 7 | ||||
-rw-r--r-- | test/test_python_application.py | 7 | ||||
-rw-r--r-- | test/test_python_atexit.py | 9 | ||||
-rw-r--r-- | test/test_python_basic.py | 7 | ||||
-rw-r--r-- | test/test_python_keepalive.py | 7 | ||||
-rw-r--r-- | test/test_python_procman.py | 7 | ||||
-rw-r--r-- | test/unit.py | 20 |
8 files changed, 17 insertions, 52 deletions
diff --git a/test/test_configuration.py b/test/test_configuration.py index b5b6a179..700e4aa1 100644 --- a/test/test_configuration.py +++ b/test/test_configuration.py @@ -4,10 +4,7 @@ import unit class TestUnitConfiguration(unit.TestUnitControl): def setUpClass(): - u = unit.TestUnit() - - u.check_modules('python') - u.check_version('0.5') + unit.TestUnit().check_modules('python') def test_json_leading_zero(self): self.assertIn('error', self.conf('00'), 'leading zero') diff --git a/test/test_php_basic.py b/test/test_php_basic.py index 884b49ee..0205c634 100644 --- a/test/test_php_basic.py +++ b/test/test_php_basic.py @@ -1,13 +1,10 @@ import unittest import unit -class TestUnitBasic(unit.TestUnitControl): +class TestUnitPHPBasic(unit.TestUnitControl): def setUpClass(): - u = unit.TestUnit() - - u.check_modules('php') - u.check_version('0.5') + unit.TestUnit().check_modules('php') conf_app = { "app": { diff --git a/test/test_python_application.py b/test/test_python_application.py index 5f9debb8..80854eb5 100644 --- a/test/test_python_application.py +++ b/test/test_python_application.py @@ -2,13 +2,10 @@ import time import unittest import unit -class TestUnitApplication(unit.TestUnitControl): +class TestUnitPythonApplication(unit.TestUnitControl): def setUpClass(): - u = unit.TestUnit() - - u.check_modules('python') - u.check_version('0.5') + unit.TestUnit().check_modules('python') def conf_with_name(self, name): self.conf({ diff --git a/test/test_python_atexit.py b/test/test_python_atexit.py index b0cb6c34..b41a80db 100644 --- a/test/test_python_atexit.py +++ b/test/test_python_atexit.py @@ -3,15 +3,12 @@ import time import unittest import unit -class TestUnitApplication(unit.TestUnitControl): +class TestUnitPythonAtExit(unit.TestUnitControl): def setUpClass(): - u = unit.TestUnit() + unit.TestUnit().check_modules('python') - u.check_modules('python') - u.check_version('0.5') - - def test_python_application(self): + def test_python_atexit(self): code, name = """ import atexit diff --git a/test/test_python_basic.py b/test/test_python_basic.py index 0c12242f..794b7197 100644 --- a/test/test_python_basic.py +++ b/test/test_python_basic.py @@ -1,13 +1,10 @@ import unittest import unit -class TestUnitBasic(unit.TestUnitControl): +class TestUnitPythonBasic(unit.TestUnitControl): def setUpClass(): - u = unit.TestUnit() - - u.check_modules('python') - u.check_version('0.5') + unit.TestUnit().check_modules('python') conf_app = { "app": { diff --git a/test/test_python_keepalive.py b/test/test_python_keepalive.py index 3f49c2b3..eadf922c 100644 --- a/test/test_python_keepalive.py +++ b/test/test_python_keepalive.py @@ -1,13 +1,10 @@ import unittest import unit -class TestUnitApplication(unit.TestUnitControl): +class TestUnitPythonKeepalive(unit.TestUnitControl): def setUpClass(): - u = unit.TestUnit() - - u.check_modules('python') - u.check_version('0.5') + unit.TestUnit().check_modules('python') def test_python_keepalive_body(self): code, name = """ diff --git a/test/test_python_procman.py b/test/test_python_procman.py index 52f5ac96..5dea007a 100644 --- a/test/test_python_procman.py +++ b/test/test_python_procman.py @@ -4,13 +4,10 @@ import subprocess import unittest import unit -class TestUnitProcman(unit.TestUnitControl): +class TestUnitPythonProcman(unit.TestUnitControl): def setUpClass(): - u = unit.TestUnit() - - u.check_modules('python') - u.check_version('0.5') + unit.TestUnit().check_modules('python') def pids_for_process(self, process=None): if process is None: diff --git a/test/unit.py b/test/unit.py index 81221a39..43f4d632 100644 --- a/test/unit.py +++ b/test/unit.py @@ -21,10 +21,6 @@ class TestUnit(unittest.TestCase): def tearDown(self): self._stop() - if '--log' in sys.argv: - with open(self.testdir + '/unit.log', 'r') as f: - print(f.read()) - if '--leave' not in sys.argv: shutil.rmtree(self.testdir) @@ -34,7 +30,7 @@ class TestUnit(unittest.TestCase): for i in range(50): with open(self.testdir + '/unit.log', 'r') as f: log = f.read() - m = re.search('controller started', log, re.M | re.S) + m = re.search('controller started', log) if m is None: time.sleep(0.1) @@ -42,11 +38,12 @@ class TestUnit(unittest.TestCase): break if m is None: + self._stop() exit("Unit is writing log too long") missed_module = '' for module in modules: - m = re.search('module: ' + module, log, re.M | re.S) + m = re.search('module: ' + module, log) if m is None: missed_module = module break @@ -57,17 +54,6 @@ class TestUnit(unittest.TestCase): if missed_module: raise unittest.SkipTest('Unit has no ' + missed_module + ' module') - def check_version(self, version): - with open(self.pardir + '/src/nxt_main.h' , 'r') as f: - m = re.search('NXT_VERSION\s+"(\d+\.\d+)"', f.read(), re.M | re.S) - - current = m.group(1).split('.') - need = version.split('.') - - for i in range(len(need)): - if need[i] > current[i]: - raise unittest.SkipTest('Unit too old') - def _run(self): self.testdir = tempfile.mkdtemp(prefix='unit-test-') |