recipes/apycot.quick.py
author David Douard <david.douard@logilab.fr>
Thu, 13 Nov 2014 14:55:11 +0100
changeset 1752 31c34cf9f19f
parent 1751 56eb553a3618
child 1601 f18dfc77fc04
permissions -rw-r--r--
[testutils] small improvements

# 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 cset, url, repoeid, checkout, setup in test.dependencies():
        # first need to retrieve the sources of the dependency
        # use the correct recipe to make the checkout and ensure the working
        # directory is at the selected revision
        src = join(test.tmpdir, 'src', str(repoeid))
        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)

    repoeid = test.penvironment['repository']['eid']
    checker, status = test.run_checker('pyunit',
                                   path=join(test.tmpdir, 'src', str(repoeid)))