recipes/apycot.quick.py
author David Douard <david.douard@logilab.fr>
Sun, 26 Oct 2014 14:43:12 +0100
changeset 1762 f3f5638439f2
parent 1760 db82548222eb
child 1607 51ba8d09c612
permissions -rw-r--r--
[apycotlib] set a 'tmpdir' CheckResultInfo if keep_dir is True

# an apycot recipe that run unit tests for python projects
import os
from os.path import join
import sys

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 each source of the source configuration, we need the URL of
    # the source repo, the changeset to use, the recipes to use to
    # make the checkout then the install, and the eid of the
    # Repository
    for cset, url, repoeid, checkout, setup in test.src_configuration():
        # we clone each repo in a dedicated directory (ensure there is
        # no collision)
        src = join(test.tmpdir, 'src', str(repoeid))
        # then execute the checkout (clone + up to cset)
        test.exec_recipe(checkout, rev=cset,
                         dst_dir=src,
                         source_url=url)
        # now perform the setup process (build and install)
        test.exec_recipe(setup,
                         test=test,
                         prefix=test.tmpdir,
                         wdir=src)
    # we can now run the checkers
    repoeid = test.penvironment['repository']['eid']
    checker, status = test.run_checker('pyunit',
                                   path=join(test.tmpdir, 'src', str(repoeid)))