Beispiel #1
0
    def testMonitorIteration(self):
        bridge = tcTests._Bridge()
        tcTests._checkDependencies()
        mon = Monitor()
        mon.start()
        iterator = iter(mon)

        bridge.addDevice()  # Generate an event to avoid blocking
        iterator.next()

        bridge.delDevice()
        iterator.next()  # Generate an event to avoid blocking

        # Stop the monitor and check that eventually StopIteration is raised.
        # There might be other system link events so we loop to exhaust them.
        mon.stop()
        with self.assertRaises(StopIteration):
            while True:
                iterator.next()
Beispiel #2
0
    def testMonitorIteration(self):
        bridge = tcTests._Bridge()
        tcTests._checkDependencies()
        mon = Monitor()
        mon.start()
        iterator = iter(mon)

        bridge.addDevice()  # Generate an event to avoid blocking
        iterator.next()

        bridge.delDevice()
        iterator.next()  # Generate an event to avoid blocking

        # Stop the monitor and check that eventually StopIteration is raised.
        # There might be other system link events so we loop to exhaust them.
        mon.stop()
        with self.assertRaises(StopIteration):
            while True:
                iterator.next()