summaryrefslogtreecommitdiffhomepage
path: root/test/unit/applications/lang/python.py
blob: fdda024af040e1cb659eefd8fa0170cdadba2a5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from unit.applications.proto import TestApplicationProto


class TestApplicationPython(TestApplicationProto):
    application_type = "python"

    def load(self, script, name=None, **kwargs):
        if name is None:
            name = script

        script_path = self.current_dir + '/python/' + script

        self._load_conf(
            {
                "listeners": {"*:7080": {"pass": "applications/" + name}},
                "applications": {
                    name: {
                        "type": self.application_type,
                        "processes": {"spare": 0},
                        "path": script_path,
                        "working_directory": script_path,
                        "module": "wsgi",
                    }
                },
            },
            **kwargs
        )