recipes/apycot.quick.py
author David Douard <david.douard@logilab.fr>
Thu, 13 Nov 2014 14:32:39 +0100
changeset 1742 3cdc3ef300a4
parent 1740 f3137466457a
child 1591 4218723fabcc
permissions -rw-r--r--
[atest] improve environment variable reporting

# an apycot recipe that run unit tests for python projects
import os
from os.path import join
from checkers.apycot import python # trigger registration
from apycotlib import narvalactions as na
# `plan` (narvalbot.engine.Plan) exists in the globals

with na.apycot_environment(plan) as test:
    for pe, rev in test.dependencies():
        # first need to retrieve the sources of the dependency
        vcsrepo = pe['repository']
        # use the correct recipe to make the checkout and ensure the working
        # directory is at the selected revision
        src = join(test.tmpdir, 'src', str(vcsrepo['eid']))
        test.exec_recipe(vcsrepo['checkout_recipe'], rev=rev,
                         dst_dir=src,
                         source_url=vcsrepo['source_url'])
        # now perform the setup process (build and install)
        test.exec_recipe(pe['setup_recipe'],
                         prefix=test.tmpdir,
                         writer=test.writer,
                         wdir=src)

    checker, status = test.run_checker('pyunit')