From d5e915934066c77a59d211efafca10c117b73d05 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Wed, 16 Sep 2020 21:31:15 +0100 Subject: Tests: migrated to the pytest. --- test/unit/applications/lang/python.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test/unit/applications/lang/python.py') diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py index 91559f4b..dcdd2ffe 100644 --- a/test/unit/applications/lang/python.py +++ b/test/unit/applications/lang/python.py @@ -1,20 +1,23 @@ import os import shutil +import pytest from unit.applications.proto import TestApplicationProto +from conftest import option class TestApplicationPython(TestApplicationProto): application_type = "python" def load(self, script, name=None, **kwargs): + print() if name is None: name = script if script[0] == '/': script_path = script else: - script_path = self.current_dir + '/python/' + script + script_path = option.test_dir + '/python/' + script if kwargs.get('isolation') and kwargs['isolation'].get('rootfs'): rootfs = kwargs['isolation']['rootfs'] @@ -27,12 +30,17 @@ class TestApplicationPython(TestApplicationProto): script_path = '/app/python/' + name + appication_type = self.get_appication_type() + + if appication_type is None: + appication_type = self.application_type + self._load_conf( { "listeners": {"*:7080": {"pass": "applications/" + name}}, "applications": { name: { - "type": self.application_type, + "type": appication_type, "processes": {"spare": 0}, "path": script_path, "working_directory": script_path, -- cgit From 1fc51cf140d22958d6dcf7e7729826b0f9671fd7 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 22 Sep 2020 19:53:19 +0300 Subject: Tests: introduced module name configuration. Also fixed problem with "/" in application name. --- test/unit/applications/lang/python.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test/unit/applications/lang/python.py') 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, } }, }, -- cgit From 6ec0ff35964c7805712d978625949f72ff5a63bc Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Wed, 7 Oct 2020 23:18:43 +0100 Subject: Tests: minor fixes. --- test/unit/applications/lang/python.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/unit/applications/lang/python.py') diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py index 75d34722..47b95dac 100644 --- a/test/unit/applications/lang/python.py +++ b/test/unit/applications/lang/python.py @@ -1,10 +1,10 @@ import os import shutil -import pytest - -from unit.applications.proto import TestApplicationProto from urllib.parse import quote + +import pytest from conftest import option +from unit.applications.proto import TestApplicationProto class TestApplicationPython(TestApplicationProto): -- cgit