python.py (1596:b7e2d4d92624) python.py (1610:ee2f7cc0f36c)
1import os
2import shutil
3import pytest
4
5from unit.applications.proto import TestApplicationProto
1import os
2import shutil
3import pytest
4
5from unit.applications.proto import TestApplicationProto
6from urllib.parse import quote
6from conftest import option
7
8
9class TestApplicationPython(TestApplicationProto):
10 application_type = "python"
7from conftest import option
8
9
10class TestApplicationPython(TestApplicationProto):
11 application_type = "python"
12 load_module = "wsgi"
11
13
12 def load(self, script, name=None, **kwargs):
14 def load(self, script, name=None, module=None, **kwargs):
13 print()
14 if name is None:
15 name = script
16
15 print()
16 if name is None:
17 name = script
18
19 if module is None:
20 module = self.load_module
21
17 if script[0] == '/':
18 script_path = script
19 else:
20 script_path = option.test_dir + '/python/' + script
21
22 if kwargs.get('isolation') and kwargs['isolation'].get('rootfs'):
23 rootfs = kwargs['isolation']['rootfs']
24

--- 7 unchanged lines hidden (view full) ---

32
33 appication_type = self.get_appication_type()
34
35 if appication_type is None:
36 appication_type = self.application_type
37
38 self._load_conf(
39 {
22 if script[0] == '/':
23 script_path = script
24 else:
25 script_path = option.test_dir + '/python/' + script
26
27 if kwargs.get('isolation') and kwargs['isolation'].get('rootfs'):
28 rootfs = kwargs['isolation']['rootfs']
29

--- 7 unchanged lines hidden (view full) ---

37
38 appication_type = self.get_appication_type()
39
40 if appication_type is None:
41 appication_type = self.application_type
42
43 self._load_conf(
44 {
40 "listeners": {"*:7080": {"pass": "applications/" + name}},
45 "listeners": {
46 "*:7080": {"pass": "applications/" + quote(name, '')}
47 },
41 "applications": {
42 name: {
43 "type": appication_type,
44 "processes": {"spare": 0},
45 "path": script_path,
46 "working_directory": script_path,
48 "applications": {
49 name: {
50 "type": appication_type,
51 "processes": {"spare": 0},
52 "path": script_path,
53 "working_directory": script_path,
47 "module": "wsgi",
54 "module": module,
48 }
49 },
50 },
51 **kwargs
52 )
55 }
56 },
57 },
58 **kwargs
59 )