Commit 4c3f595c authored by Jérome Perrin's avatar Jérome Perrin

fixup! test.utils.makeRecipe: support running from software folder

unlike what I assumed, env argument of ConfigParser.get does not work as
dict.get, it has priority.

This broke the case of SLAPOS-EGG-TEST

Rewrite this using ConfigParser.has_option
parent 43f5ac2f
...@@ -54,16 +54,17 @@ def makeRecipe(recipe_class, options, name='test', slap_connection=None): ...@@ -54,16 +54,17 @@ def makeRecipe(recipe_class, options, name='test', slap_connection=None):
if os.path.exists(buildout_cfg): if os.path.exists(buildout_cfg):
parser = ConfigParser() parser = ConfigParser()
parser.readfp(open(buildout_cfg)) parser.readfp(open(buildout_cfg))
eggs_directory = parser.get( if parser.has_option('buildout', 'eggs-directory'):
'buildout', # when buildout_cfg is an instance buildout (like in SLAPOS-EGG-TEST),
'eggs-directory', # there's a ${buildout:eggs-directory} we can use.
# default, for the case when buildout_cfg is a software buildout eggs_directory = parser.get('buildout', 'eggs-directory')
# like with SLAPOS-SR-TEST. develop_eggs_directory = parser.get('buildout', 'develop-eggs-directory')
vars={'eggs-directory': os.path.join(base_directory, 'eggs')}) else:
develop_eggs_directory = parser.get( # when when buildout_cfg is a software buildout, we can only guess the
'buildout', # standard eggs directories.
'develop-eggs-directory', eggs_directory = os.path.join(base_directory, 'eggs')
vars={'develop-eggs-directory': os.path.join(base_directory, 'develop-eggs')}) develop_eggs_directory = os.path.join(base_directory, 'develop-eggs')
logging.getLogger(__name__).info( logging.getLogger(__name__).info(
'Using eggs-directory (%s) and develop-eggs-directory (%s) from buildout at %s', 'Using eggs-directory (%s) and develop-eggs-directory (%s) from buildout at %s',
eggs_directory, eggs_directory,
......
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