author David Douard <>
Sun, 09 Nov 2014 20:07:45 +0100
changeset 1773 35a2edaa84e5
parent 1769 8e817371cba1
permissions -rw-r--r--
[migration] add a migration script for 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 Command, narvalactions as na
# `plan` (narvalbot.engine.Plan) exists in the globals

with na.apycot_environment(plan) as test:
    # setup a virtualenv
    Command(test.writer, ['virtualenv', '--system-site-packages', test.tmpdir], raises=True).run()
    os.environ['PATH'] = ':'.join([join(test.tmpdir, 'bin'), os.environ['PATH']])
    os.environ['VIRTUAL_ENV'] = test.tmpdir
    # 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('pyunit')