Commit 3b375acb authored by Jérome Perrin's avatar Jérome Perrin

README: add a minimal test for slapos.recipe.build default recipe

parent 9eb7ea7f
......@@ -48,6 +48,71 @@ Using the init option::
[section-two]
bar = ${section-one:foo}
A simplified example::
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = section-two
...
... [section-one]
... recipe = slapos.recipe.build
... init =
... options['foo'] = 'foo from section-one'
...
... [section-two]
... recipe = slapos.recipe.build
... bar = ${section-one:foo}
... install =
... import os
... os.mkdir(options['location'])
... print('Installed section-two with option %s.' % options['bar'])
... """)
>>> print(system(buildout))
Installing section-one.
Installing section-two.
Installed section-two with option foo from section-one.
...
>>> ls(sample_buildout, 'parts')
d section-two
In case of error, a proper traceback is displayed and nothing is installed
>>> write(sample_buildout, 'buildout.cfg',
... """
... [buildout]
... parts = section-two
...
... [section-two]
... recipe = slapos.recipe.build
... install =
... import os
... os.mkdir(options['location'])
... print(1 / 0.) # this is an error !
... """)
>>> print(system(buildout))
Uninstalling section-two.
Uninstalling section-one.
Installing section-two.
...
While:
Installing section-two.
<BLANKLINE>
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
...
File "<string>", line 3, in <module>
ZeroDivisionError: float division by zero
>>> ls(sample_buildout, 'parts')
<BLANKLINE>
Pure download
~~~~~~~~~~~~~
......
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