Ejemplo n.º 1
0
class DieselTest(object):
    def setup_method(self, *args):
        self._app = Application(allow_app_replacement=True)
        self._trigger = TestTrigger()

    # XXX py.test magic args?
    def prepare_test(self):
        return self._app, self._trigger.touch, TestAccumulator()

    def run_test(self, count=1, timeout=10):
        def trigger_thread():
            self._trigger.wait(timeout, count)
            try:
                self._app.halt()
            except app.ApplicationEnd:
                # XXX Does halt have to raise this? Should we do anything but
                # pass?
                pass
            self._app.hub.wake_from_other_thread()

        thread.start_new_thread(trigger_thread, ())
        self._app.run()
        if self._trigger.timed_out:
            raise TestTimeout()

    def teardown_method(self, *args):
        try:
            self._app.halt()
        except app.ApplicationEnd:
            # This is always raised?
            pass
        self._app = self._trigger = None
Ejemplo n.º 2
0
class DieselTest(object):
    def setup_method(self, *args):
        self._app = Application(allow_app_replacement=True)
        self._trigger = TestTrigger()

    # XXX py.test magic args?
    def prepare_test(self):
        return self._app, self._trigger.touch, TestAccumulator()

    def run_test(self, count=1, timeout=10):
        def trigger_thread():
            self._trigger.wait(timeout, count)
            try:
                self._app.halt()
            except app.ApplicationEnd:
                # XXX Does halt have to raise this? Should we do anything but
                # pass?
                pass
            self._app.hub.wake_from_other_thread()

        thread.start_new_thread(trigger_thread, ())
        self._app.run()
        if self._trigger.timed_out:
            raise TestTimeout()

    def teardown_method(self, *args):
        try:
            self._app.halt()
        except app.ApplicationEnd:
            # This is always raised?
            pass
        self._app = self._trigger = None
Ejemplo n.º 3
0
class DieselTest(object):
    def setup_method(self, *args):
        self._app = Application(allow_app_replacement=True)
        self._trigger = TestTrigger()

    # XXX py.test magic args?
    def prepare_test(self):
        return self._app, self._trigger.touch, TestAccumulator()

    def run_test(self, count=1, timeout=10):
        def trigger_thread():
            self._trigger.wait(timeout, count)
            self._app.halt()
            self._app.hub.wake_from_other_thread()
            
        thread.start_new_thread(trigger_thread, ())
        self._app.run()
        if self._trigger.timed_out:
            raise TestTimeout()

    def teardown_method(self, *args):
        self._app.halt()
        self._app = self._trigger = None