# 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')