author David Douard <>
Tue, 13 Jan 2015 14:19:00 +0100
changeset 1783 e3aad84adf03
parent 1777 46fc18db6cc5
permissions -rw-r--r--
[pkg] prepare 4.0.0

# 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, ERROR
# `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,
        # now perform the setup process (build and install)
    # we can now run the checkers
    repoeid = test.penvironment['repository']['eid']
    test.set_project_path(join(test.tmpdir, 'src', str(repoeid)))

    checker, status = test.run_checker('pylint')
    checker, status = test.run_checker('pyunit')
    if status > ERROR and checker.coverage_data:
        checker, status = test.run_checker('pycoverage',