Update egg_test and erp5_test to support specific environment

parent fddc2b79
...@@ -100,16 +100,37 @@ class CloudoooRecipe(GenericBaseRecipe): ...@@ -100,16 +100,37 @@ class CloudoooRecipe(GenericBaseRecipe):
return path_list return path_list
class EggTestRecipe(GenericBaseRecipe): class EggTestRecipe(GenericBaseRecipe):
"""
Recipe used to create wrapper used to run test suite (python setup.py test)
off a list of Python eggs.
"""
def install(self): def install(self):
path_list = [] path_list = []
common_dict = dict() test_list = self.options['test-list'].strip().replace('\n', ',')
# prepend_path=self.options['prepend-path'], common_dict = {}
#)
common_list = [ "--source-core-path-list", self.options['test-list']]
path_list.append(self.createPythonScript(self.options['run-test-suite'],
__name__ + '.test.runTestSuite', [dict(
call_list=[self.options['run-test-suite-binary'],
] + common_list, **common_dict)]))
return path_list environment_dict = {}
if self.options.get('environment'):
environment_part = self.buildout.get(self.options['environment'])
if environment_part:
for key, value in environment_part.iteritems():
environment_dict[key] = value
common_list = [ "--source_code_path_list", test_list]
argument_dict = dict(
call_list=[self.options['run-test-suite-binary'],] + common_list,
environment=environment_dict,
**common_dict
)
if 'prepend-path' in self.options:
argument_dict['prepend_path'] = self.options['prepend-path']
run_test_suite_script = self.createPythonScript(
self.options['run-test-suite'], __name__ + '.test.runTestSuite',
[argument_dict]
)
path_list.append(run_test_suite_script)
return path_list
...@@ -39,6 +39,10 @@ def runTestSuite(args): ...@@ -39,6 +39,10 @@ def runTestSuite(args):
env['INSTANCE_HOME'] = d['instance_home'] env['INSTANCE_HOME'] = d['instance_home']
env['REAL_INSTANCE_HOME'] = d['instance_home'] env['REAL_INSTANCE_HOME'] = d['instance_home']
# If defined, will add (and replace if existing) envvars to environment.
if 'environment' in d:
env.update(d['environment'])
# Deal with Shebang size limitation # Deal with Shebang size limitation
executable_filepath = d['call_list'][0] executable_filepath = d['call_list'][0]
file_object = open(executable_filepath, 'r') file_object = open(executable_filepath, 'r')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment