"""Test case that manages Mynewt IUT"""
from ptsprojects.testcase import TestCaseLT1, TestCaseLT2, TestFunc, \
TestFuncCleanUp
from ptsprojects.stack import get_stack
from ptsprojects.mynewt.iutctl import get_iut
class ZTestCase(TestCaseLT1):
"""A Mynewt test case that uses QEMU or HW as DUT"""
def __init__(self, *args, **kwargs):
"""Refer to TestCase.__init__ for parameters and their documentation"""
super(ZTestCase, self).__init__(*args, ptsproject_name="mynewt",
**kwargs)
self.stack = get_stack()
self.mynewtctl = get_iut()
self.cmds.insert(0, TestFunc(self.mynewtctl.start))
self.cmds.insert(1, TestFunc(self.mynewtctl.wait_iut_ready_event))
self.cmds.append(TestFuncCleanUp(self.stack.cleanup))
self.cmds.append(TestFuncCleanUp(self.mynewtctl.stop))
class ZTestCaseSlave(TestCaseLT2):
"""A Mynewt helper test case that uses QEMU or HW as DUT"""
def __init__(self, *args, **kwargs):
"""Refer to TestCase.__init__ for parameters and their documentation"""
super(ZTestCaseSlave, self).__init__(*args, ptsproject_name="mynewt",
**kwargs)