Commit 19ee4509 authored by Vivien Alger's avatar Vivien Alger

Refactored recipe so that everything is in one wrapper

parent 166975d9
...@@ -46,47 +46,31 @@ class Recipe(BaseSlapRecipe): ...@@ -46,47 +46,31 @@ class Recipe(BaseSlapRecipe):
self.path_list = [] self.path_list = []
self.requirements, self.ws = self.egg.working_set() self.requirements, self.ws = self.egg.working_set()
xvfb_conf = self.instaciateXvfb()
self.instanciateTestRunner(xvfb_conf['display']) self.instanciateTestRunner(self.getDisplay())
self.linkBinary() self.linkBinary()
self.computer_partition_setConnectionDict()
return self.path_list return self.path_list
def instanciateXvfb(self): def getDisplay(self):
""" """
Create Xvfb configuration dictionnary and instanciate a wrapper for it Choose a display for the instance
Parameters : None Parameters : None
Returns : Dictionnary xvfb_conf Returns : display
""" """
xvfb_conf={}
xvfb_conf['xvfb_binary'] = self.options['xvfb_binary']
display_list = [":%s" % i for i in range(123,144)] display_list = [":%s" % i for i in range(123,144)]
for display_try in display_list: for display_try in display_list:
lock_filepath = '/tmp/.X%s-lock' % display_try.replace(":", "") lock_filepath = '/tmp/.X%s-lock' % display_try.replace(":", "")
if not os.path.exists(lock_filepath): if not os.path.exists(lock_filepath):
xvfb_conf['display'] = display_try display = display_try
break break
xvfb_template_location = pkg_resources.resource_filename( return display
__name__, os.path.join(
'template', 'xvfb_run.in'))
xvfb_runner_path = self.createRunningWrapper("Xvfb",
self.substituteTemplate(xvfb_template_location,
xvfb_conf))
self.path_list.append(xvfb_runner_path)
return xvfb_conf
def instanciateTestRunner(self, display): def instanciateTestRunner(self, display):
""" """
...@@ -97,17 +81,21 @@ class Recipe(BaseSlapRecipe): ...@@ -97,17 +81,21 @@ class Recipe(BaseSlapRecipe):
Returns : None Returns : None
""" """
self.path_list.extend(zc.buildout.easy_install.scripts([( if self.parameter_dict['browser'] == 'chrome' or self.parameter_dict['browser'] == 'chromium':
'selenium',__name__+'.testrunner', 'run')], self.ws, self.path_list.extend(zc.buildout.easy_install.scripts([(
'testrunner',__name__+'.testrunner', 'run')], self.ws,
sys.executable, self.wrapper_directory, arguments=[ sys.executable, self.wrapper_directory, arguments=[
dict( dict(
browser_binary = self.options['chromium_binary'], browser_binary = self.options['chromium_binary'],
display = display, xvfb_binary = self.options['xvfb_binary'],
option = "--ignore-certificate-errors --disable-translate --disable-web-security", display = display,
suite_name = self.parameter_dict['suite_name'], option_ssl = '--ignore-certificate-errors',
base_url = self.parameter_dict['url'], option_translate = '--disable-translate',
user = self.parameter_dict['user'], option_security = '--disable-web-security',
password = self.paramer_dict['password'] suite_name = self.parameter_dict['suite_name'],
base_url = self.parameter_dict['url'],
user = self.parameter_dict['user'],
password = self.parameter_dict['password']
)])) )]))
def linkBinary(self): def linkBinary(self):
......
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