def session(request): s = Session(add_all=False) s, _ = _add_device(s) yield s # force session destruction s._close()
def session(request): """Default session adding all attached devices.""" s = Session() yield s # force session destruction s._close()
def test_read_initial_data(): """Verify data values of HI-Z samples on initial attach. See https://github.com/analogdevicesinc/m1k-fw/issues/9 for details. """ sys.stdout.write('\n') prompt( 'unplug the device, ground the metal USB connector, and plug it back in' ) # create our own session to avoid detach exceptions session = Session(add_all=False) session, device = _add_device(session) samples = device.get_samples(100) assert len(samples) == 100 # verify all samples are near 0 tests = [] for sample in samples: for x in chain.from_iterable(sample): tests.append(abs(round(x)) == 0) # old firmware versions exhibit bad data, newer versions should fix the issue if float(device.fwver) <= 2.10: assert not all(tests) else: assert all(tests) # request a bunch of extra samples to flush bad values device.get_samples(10000) # force session destruction session._close()
def session(request): s = Session(add_all=False) if s.scan() == 0: # no devices plugged in raise ValueError s.add(s.available_devices[0]) yield s # force session destruction s._close()
def test_read_continuous_dataflow_raises(): """Verify workflows that lead to data flow issues.""" # create a session that doesn't ignore data flow issues session = Session(add_all=False, ignore_dataflow=False) session.scan() session.add(session.available_devices[0]) device = session.devices[0] session.start(0) time.sleep(.5) with pytest.raises(SampleDrop): device.read(1000) # force session destruction session._close()
def session(): s = Session(add_all=False) yield s # force session destruction s._close()
def session(request): s = Session() yield s # force session destruction s._close()