author David Douard <david.douard@logilab.fr>
Fri, 14 Nov 2014 12:51:47 +0100
changeset 1740 f3137466457a
parent 1736 72ec6c7e956c
child 1599 8aed1b3a6605
permissions -rw-r--r--
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

import os
import os.path as osp
from shutil import rmtree

from logilab.common.shellutils import unzip
from logilab.common.testlib import unittest_main

import cubicweb.devtools
import cubes.apycot.testutils as utils

DATA = osp.join(osp.dirname(__file__), 'data')
os.environ['HGRCPATH'] = os.devnull

class ApycotTC(utils.ApycotBaseTC):
    _repo_path = (u'project',)

    def test_quick_recipe(self):
        with self.admin_access.client_cnx() as cnx:
            tc = cnx.find('TestConfig', name='tc_project1').one()
            pe = cnx.fond('ProjectEnviironment', name='pe_project1').one()
            te = tc.start(pe).eid
        with self.admin_access.client_cnx() as cnx:
            te = cnx.entity_from_eid(te)
            self.assertEqual(dict((checker.name, checker.status) for checker in te.checkers),
                             {'pyunit': 'nodata'})

    def test_full_recipe(self):
        with self.admin_access.client_cnx() as cnx:
            lgce = cnx.entity_from_eid(self.lgce)
            recipe = cnx.execute('Recipe X WHERE X name "apycot.recipe.full"').get_entity(0, 0)
            # reset recipe content
            tc = self.add_test_config(cnx, u'full config', env=self.lgce, group=self.pyp,
            te = tc.start(lgce).eid
        with self.admin_access.client_cnx() as cnx:
            te = cnx.entity_from_eid(te)
            exp = {u'pycoverage': u'error', u'pyunit': u'nodata'}
                # do only check pylint tests where executed if pylint
                # is available
                from pylint import checkers as pycheckers
                from pylint.lint import PyLinter
                from pylint.__pkginfo__ import version as pylint_version
                from pylint.interfaces import IReporter
                from pylint.reporters import BaseReporter
                exp['pylint'] = u'error'
                                 dict((checker.name, checker.status) for checker in te.checkers),

if __name__ == '__main__':