_apycotlib/narvalactions.py
author David Douard <david.douard@logilab.fr>
Tue, 13 Jan 2015 14:19:00 +0100
changeset 1783 e3aad84adf03
parent 1746 4d9ae2462503
permissions -rw-r--r--
[pkg] prepare 4.0.0

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)
        test.setup()
        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
        self.test.clean()