Tests: introduced module name configuration.
Also fixed problem with "/" in application name.
This commit is contained in:
@@ -3,17 +3,22 @@ import shutil
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from unit.applications.proto import TestApplicationProto
|
from unit.applications.proto import TestApplicationProto
|
||||||
|
from urllib.parse import quote
|
||||||
from conftest import option
|
from conftest import option
|
||||||
|
|
||||||
|
|
||||||
class TestApplicationPython(TestApplicationProto):
|
class TestApplicationPython(TestApplicationProto):
|
||||||
application_type = "python"
|
application_type = "python"
|
||||||
|
load_module = "wsgi"
|
||||||
|
|
||||||
def load(self, script, name=None, **kwargs):
|
def load(self, script, name=None, module=None, **kwargs):
|
||||||
print()
|
print()
|
||||||
if name is None:
|
if name is None:
|
||||||
name = script
|
name = script
|
||||||
|
|
||||||
|
if module is None:
|
||||||
|
module = self.load_module
|
||||||
|
|
||||||
if script[0] == '/':
|
if script[0] == '/':
|
||||||
script_path = script
|
script_path = script
|
||||||
else:
|
else:
|
||||||
@@ -37,14 +42,16 @@ class TestApplicationPython(TestApplicationProto):
|
|||||||
|
|
||||||
self._load_conf(
|
self._load_conf(
|
||||||
{
|
{
|
||||||
"listeners": {"*:7080": {"pass": "applications/" + name}},
|
"listeners": {
|
||||||
|
"*:7080": {"pass": "applications/" + quote(name, '')}
|
||||||
|
},
|
||||||
"applications": {
|
"applications": {
|
||||||
name: {
|
name: {
|
||||||
"type": appication_type,
|
"type": appication_type,
|
||||||
"processes": {"spare": 0},
|
"processes": {"spare": 0},
|
||||||
"path": script_path,
|
"path": script_path,
|
||||||
"working_directory": script_path,
|
"working_directory": script_path,
|
||||||
"module": "wsgi",
|
"module": module,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user