Commit c7fde206 authored by Xavier Thompson's avatar Xavier Thompson

software/buildout-testing: Reuse installed eggs

Install test eggs in software and pass them to runTestSuite so that
launching the tests reuses the installed eggs.
parent 26d591ae
...@@ -18,6 +18,9 @@ test_dict = { ...@@ -18,6 +18,9 @@ test_dict = {
'zc.recipe.egg': os.path.join(slapos_buildout, 'zc.recipe.egg_'), 'zc.recipe.egg': os.path.join(slapos_buildout, 'zc.recipe.egg_'),
} }
already_available_egg_paths = {{ repr(egg_paths) }}
class DummyTestResult: class DummyTestResult:
class DummyTestResultLine: class DummyTestResultLine:
...@@ -98,17 +101,12 @@ def main(): ...@@ -98,17 +101,12 @@ def main():
try: try:
os.write(fd, str2bytes("""\ os.write(fd, str2bytes("""\
[buildout] [buildout]
develop =%s develop =
%s
parts = testrunner parts = testrunner
newest = false offline = true
versions = versions extra-paths =
%s
[versions]
%s
zope.exceptions = 4.6
zope.interface = 5.4.0
zope.testing = 4.7
zope.testrunner = 5.2
[testrunner] [testrunner]
recipe = zc.recipe.egg recipe = zc.recipe.egg
...@@ -119,11 +117,13 @@ eggs = ...@@ -119,11 +117,13 @@ eggs =
zope.testrunner zope.testrunner
scripts = scripts =
zope-testrunner zope-testrunner
extra-paths =%s extra-paths =
""" % (''.join('\n ' + x for x in test_dict.values()), %s
'\n'.join(x + ' =' for x in test_dict), """ % (
''.join('\n ' + get_distribution(x).location for x in ('manuel', 'six')), '\n '.join(x for x in test_dict.values()),
))) '\n '.join(p for p in already_available_egg_paths),
'\n '.join(get_distribution(x).location for x in ('manuel', 'six')),
)))
finally: finally:
os.close(fd) os.close(fd)
Buildout('buildout.cfg', {}).install(None) Buildout('buildout.cfg', {}).install(None)
......
...@@ -7,17 +7,29 @@ parts = ...@@ -7,17 +7,29 @@ parts =
[slapos.buildout-repository] [slapos.buildout-repository]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/nexedi/slapos.buildout.git repository = https://lab.nexedi.com/xavier_thompson/slapos.buildout.git
branch = testing/buildout
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
[runTestSuite_py] [runTestSuite_py]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = erp5.util eggs =
zc.buildout erp5.util
manuel zc.buildout[test]
zope.exceptions
zope.interface
zope.testing
zope.testrunner
scripts = ${:interpreter} scripts = ${:interpreter}
interpreter = ${:_buildout_section_name_} interpreter = ${:_buildout_section_name_}
[egg-list]
recipe = slapos.recipe.build
eggs = ${runTestSuite_py:eggs}
init =
options['egg-list'] = '\n '.join(options['eggs'].split())
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
# XXX: "template.cfg" is hardcoded in instanciation recipe # XXX: "template.cfg" is hardcoded in instanciation recipe
...@@ -47,6 +59,22 @@ inline = ...@@ -47,6 +59,22 @@ inline =
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
shared = true shared = true
[egg-paths]
recipe = slapos.recipe.build
eggs = ${egg-list:egg-list}
init =
import zc.buildout.easy_install
eggs = options['eggs'].split()
buildout = self.buildout['buildout']
ws = zc.buildout.easy_install.working_set(
eggs,
[buildout['eggs-directory'], buildout['develop-eggs-directory']],
)
options['egg-paths'] = [
d.location for d in ws
if d.project_name not in ('zc.buildout', 'zc.recipe.egg')
]
[runTestSuite] [runTestSuite]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
output = $${directory:bin}/$${:_buildout_section_name_} output = $${directory:bin}/$${:_buildout_section_name_}
...@@ -55,4 +83,15 @@ inline = ...@@ -55,4 +83,15 @@ inline =
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key slapos_buildout slapos.buildout-repository:location key slapos_buildout slapos.buildout-repository:location
key temp_directory directory:tmp key temp_directory directory:tmp
key egg_paths egg-paths:egg-paths
raw runTestSuite_py ${buildout:bin-directory}/${runTestSuite_py:interpreter} raw runTestSuite_py ${buildout:bin-directory}/${runTestSuite_py:interpreter}
[versions]
zope.exceptions = 4.6
zope.interface = 5.4.0
zope.testing = 4.7
zope.testrunner = 5.2
zc.zdaemonrecipe = 1.0.0
zc.recipe.deployment = 1.3.0
WebOb = 1.8.9
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