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_atexit.py | |
parent | babf67712e4226527730e2fb8c96babdf5486ca5 (diff) | |
download | unit-09f2009df564ab2063ee4713ba24247039945146.tar.gz unit-09f2009df564ab2063ee4713ba24247039945146.tar.bz2 |
Tests: reworked python tests with application.
Diffstat (limited to '')
-rw-r--r-- | test/test_python_atexit.py | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/test/test_python_atexit.py b/test/test_python_atexit.py index b41a80db..a115a192 100644 --- a/test/test_python_atexit.py +++ b/test/test_python_atexit.py @@ -3,46 +3,20 @@ import time import unittest import unit -class TestUnitPythonAtExit(unit.TestUnitControl): +class TestUnitPythonAtExit(unit.TestUnitApplicationPython): def setUpClass(): unit.TestUnit().check_modules('python') def test_python_atexit(self): - code, name = """ -import atexit + self.load('atexit') -def create_file(): - open('%s', 'w') - -atexit.register(create_file) - -def application(env, start_response): - start_response('200', [('Content-Length', '0')]) - return [] - -""" % (self.testdir + '/atexit'), 'py_app' - - self.python_application(name, code) - - self.conf({ - "listeners": { - "*:7080": { - "application": "app" - } - }, - "applications": { - "app": { - "type": "python", - "processes": { "spare": 0 }, - "path": self.testdir + '/' + name, - "module": "wsgi" - } - } + self.get(headers={ + 'Host': 'localhost', + 'Test-Dir': self.testdir, + 'Connection': 'close' }) - self.get() - self.conf({ "listeners": {}, "applications": {} @@ -53,6 +27,5 @@ def application(env, start_response): self.assertEqual(os.path.exists(self.testdir + '/atexit'), True, 'python atexit') - if __name__ == '__main__': unittest.main() |