diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2018-02-20 20:34:41 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2018-02-20 20:34:41 +0300 |
commit | 09f2009df564ab2063ee4713ba24247039945146 (patch) | |
tree | 5c719060dd4af2ca932da96d93d77eeebc6c5f25 /test/test_python_procman.py | |
parent | babf67712e4226527730e2fb8c96babdf5486ca5 (diff) | |
download | unit-09f2009df564ab2063ee4713ba24247039945146.tar.gz unit-09f2009df564ab2063ee4713ba24247039945146.tar.bz2 |
Tests: reworked python tests with application.
Diffstat (limited to 'test/test_python_procman.py')
-rw-r--r-- | test/test_python_procman.py | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/test/test_python_procman.py b/test/test_python_procman.py index 5dea007a..f1187795 100644 --- a/test/test_python_procman.py +++ b/test/test_python_procman.py @@ -4,21 +4,18 @@ import subprocess import unittest import unit -class TestUnitPythonProcman(unit.TestUnitControl): +class TestUnitPythonProcman(unit.TestUnitApplicationPython): def setUpClass(): unit.TestUnit().check_modules('python') - def pids_for_process(self, process=None): - if process is None: - process = self.app_name - + def pids_for_process(self): time.sleep(0.2) output = subprocess.check_output(['ps', 'ax']) pids = set() - for m in re.findall('.*' + process, output.decode()): + for m in re.findall('.*' + self.app_name, output.decode()): pids.add(re.search('^\s*(\d+)', m).group(1)) return pids @@ -26,33 +23,8 @@ class TestUnitPythonProcman(unit.TestUnitControl): def setUp(self): super().setUp() - code, name = """ - -def application(env, start_response): - start_response('200', [('Content-Length', '0')]) - return [] - -""", 'py_app' - self.app_name = "app-" + self.testdir.split('/')[-1] - - self.python_application(name, code) - - self.conf({ - "listeners": { - "*:7080": { - "application": self.app_name - } - }, - "applications": { - self.app_name: { - "type": "python", - "processes": { "spare": 0 }, - "path": self.testdir + '/' + name, - "module": "wsgi" - } - } - }) + self.load('empty', self.app_name) def test_python_processes_access(self): self.conf('1', '/applications/' + self.app_name + '/processes') |