Example #1
0
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()
Example #2
0
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()
Example #3
0
def session(request):
    session = Session(add_all=False)
    session.scan()
    return session
Example #4
0
# events, use Ctrl-C to exit.

from __future__ import print_function

from signal import signal, SIG_DFL, SIGINT
import time

from pysmu import Session

session = Session()
last_devices = session.available_devices

while True:
    time.sleep(2)

    session.scan()
    available_devices = session.available_devices

    for other_device in last_devices:
        found = False

        for device in available_devices:
            if other_device.serial == device.serial:
                found = True
                break

        if not found:
            print("Device detached!")
            tmp = list(last_devices)
            tmp.remove(other_device)
            last_devices = tuple(tmp)