test/test_functional.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 16 Jan 2013 17:40:11 +0100
changeset 1421 00b78e701b79
parent 1006 e50f134e41b7
child 846 df4adef04c18
child 1030 184ac214fc78
child 1443 9d7e65b017f0
permissions -rw-r--r--
restore and unittest apycot.recipe.full

import os.path as osp
import subprocess
import shutil

import utils

from cubes.apycot.recipes import full_script

HERE = osp.abspath(osp.dirname(__file__))
def setUpModule():
    subprocess.check_call(['hg', 'init', '-q', osp.join(HERE, 'data', 'project')])
    subprocess.check_call(['hg', 'addremove', '-q', '-R', osp.join(HERE, 'data', 'project')])
    subprocess.check_call(['hg', 'commit', '-q', '-R', osp.join(HERE, 'data', 'project'), '-m', 'ze rev'])

def tearDownModule():
    shutil.rmtree(osp.join(HERE, 'data', 'project', '.hg'))

class ApycotTC(utils.ApycotBaseTC):

    def test_quick_recipe(self):
        te = self.lgc.start(self.lgce)
        self.commit()
        self.run_plan(te)
        self.assertEqual(dict((checker.name, checker.status) for checker in te.checkers),
                         {'pyunit': 'nodata'})


    def test_full_recipe(self):
        recipe = self.req.execute('Recipe X WHERE X name "apycot.recipe.full"').get_entity(0, 0)
        # reset recipe content
        recipe.set_attributes(script=full_script)
        tc = self.add_test_config(u'full config', env=self.lgce, group=self.pyp,
                                  use_recipe=recipe)
        te = tc.start(self.lgce)
        self.commit()
        self.run_plan(te)
        self.assertEqual(dict((checker.name, checker.status) for checker in te.checkers),
                         {u'pycoverage': u'error', u'pylint': u'error', u'pyunit': u'nodata'})