Exemplo n.º 1
0
def con():
    hw = HardwareManager(port='virtual:./radiation_device.py')
    hw.connect_direct(1)
    con = hw.controller()
    yield con

    hw.disconnect()
Exemplo n.º 2
0
class TestBLED112Loopback(unittest.TestCase):
    def setUp(self):
        self.vdev = subprocess.Popen(
            ['virtual_device', 'bled112', 'report_test'])

        bleds = BLED112Adapter.find_bled112_devices()
        print(bleds)
        self.hw = HardwareManager(port='bled112:{}'.format(bleds[1]))

    def tearDown(self):
        self.hw.close()
        self.vdev.terminate()

    def test_loopback(self):
        time.sleep(2)
        print(self.hw.scan())
        self.hw.connect(1)
        con = self.hw.controller()
        assert con.ModuleName() == 'Simple'

        self.hw.enable_streaming()
        assert self.hw.count_reports() == 11