author David Douard <david.douard@logilab.fr>
Wed, 27 Sep 2017 12:39:06 +0200
changeset 1871 980e20892562
parent 1550 d77b516a8f00
child 1574 cd33e04f6433
permissions -rw-r--r--
[checker/pypi] allow to configure the pypi repo to use and defaults to 'pypi'.

from apycotlib import atest, writer, ERROR

class apycot_environment(object):
    def __init__(self, plan):
        self.plan = plan

    def __enter__(self):
        w  = writer.TestDataWriter(self.plan.cnxh, self.plan.plandata['eid'])
        test = atest.Test(self.plan.plandata, w)
        self.test = test
        return test

    def __exit__(self, exc_type, exc_val, exc_tb):
        if exc_type is not None:
            self.test.global_status = ERROR

def install_environment(test):
    texec_url = test.writer.cnxh.instance_url + str(test.texec['eid'])
    data = test.writer.cnxh.http_get(texec_url, vid='apycot.get_dependencies')
    for dep in data[0]:
        test.call_preprocessor('install', dep)