node.py (1293:40251b822c85) node.py (1303:248eeec4c272)
1import os
2import shutil
3from unit.applications.proto import TestApplicationProto
4
5
6class TestApplicationNode(TestApplicationProto):
7 @classmethod
8 def setUpClass(cls, complete_check=True):
9 unit = super().setUpClass(complete_check=False)
10
11 # check node module
12
13 if os.path.exists(unit.pardir + '/node/node_modules'):
14 cls.available['modules']['node'] = []
15
16 return unit if not complete_check else unit.complete()
17
1import os
2import shutil
3from unit.applications.proto import TestApplicationProto
4
5
6class TestApplicationNode(TestApplicationProto):
7 @classmethod
8 def setUpClass(cls, complete_check=True):
9 unit = super().setUpClass(complete_check=False)
10
11 # check node module
12
13 if os.path.exists(unit.pardir + '/node/node_modules'):
14 cls.available['modules']['node'] = []
15
16 return unit if not complete_check else unit.complete()
17
18 def load(self, script, name='app.js'):
18 def load(self, script, name='app.js', **kwargs):
19 # copy application
20
21 shutil.copytree(
22 self.current_dir + '/node/' + script, self.testdir + '/node'
23 )
24
25 # copy modules
26

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

37 "applications": {
38 script: {
39 "type": "external",
40 "processes": {"spare": 0},
41 "working_directory": self.testdir + '/node',
42 "executable": name,
43 }
44 },
19 # copy application
20
21 shutil.copytree(
22 self.current_dir + '/node/' + script, self.testdir + '/node'
23 )
24
25 # copy modules
26

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

37 "applications": {
38 script: {
39 "type": "external",
40 "processes": {"spare": 0},
41 "working_directory": self.testdir + '/node',
42 "executable": name,
43 }
44 },
45 }
45 },
46 **kwargs
46 )
47 )