diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-09-22 19:53:19 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-09-22 19:53:19 +0300 |
commit | 1fc51cf140d22958d6dcf7e7729826b0f9671fd7 (patch) | |
tree | 97c8cabfd58d3b392c550b8b0d9b1376342c5d16 /test/unit/applications/lang/python.py | |
parent | dc49c561e204fd70008aa6af8c6171ef7d227db1 (diff) | |
download | unit-1fc51cf140d22958d6dcf7e7729826b0f9671fd7.tar.gz unit-1fc51cf140d22958d6dcf7e7729826b0f9671fd7.tar.bz2 |
Tests: introduced module name configuration.
Also fixed problem with "/" in application name.
Diffstat (limited to 'test/unit/applications/lang/python.py')
-rw-r--r-- | test/unit/applications/lang/python.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py index dcdd2ffe..75d34722 100644 --- a/test/unit/applications/lang/python.py +++ b/test/unit/applications/lang/python.py @@ -3,17 +3,22 @@ import shutil import pytest from unit.applications.proto import TestApplicationProto +from urllib.parse import quote from conftest import option class TestApplicationPython(TestApplicationProto): application_type = "python" + load_module = "wsgi" - def load(self, script, name=None, **kwargs): + def load(self, script, name=None, module=None, **kwargs): print() if name is None: name = script + if module is None: + module = self.load_module + if script[0] == '/': script_path = script else: @@ -37,14 +42,16 @@ class TestApplicationPython(TestApplicationProto): self._load_conf( { - "listeners": {"*:7080": {"pass": "applications/" + name}}, + "listeners": { + "*:7080": {"pass": "applications/" + quote(name, '')} + }, "applications": { name: { "type": appication_type, "processes": {"spare": 0}, "path": script_path, "working_directory": script_path, - "module": "wsgi", + "module": module, } }, }, |