Big Refactoring (BR) of the test execution model
Get rid of narval preprocessors in favor of Recipes
- Each preprocessing recipe must be run from the "main" recipe (thus we add
a ATest.exec_recipe() method that can be called from Recipe execution).
- We add a (Repository, checkout_recipe, Recipe) relation, which is the
Recipe that tells how to retrieve the code for a given Repository
- Also add a (ProjectEnvironment, setup_recipe, Recip) dedicated to perform
the installation for a project (compile and install)
- Add implementations for these recipes for Python project
- Rewrite the quick recipe using this new model
# 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')