コード例 #1
0
def mbus_tcp():
    return MBus.MBus(host="127.0.0.1")
コード例 #2
0
def test_libpath_shared_object_path():
    foo = MBus.MBus(libpath="/usr/local/lib/libmbus.so", host="127.0.0.1")
コード例 #3
0
def mbus_tcp_connected():
    tmp = MBus.MBus(host="127.0.0.1")
    return tmp.connect()
コード例 #4
0
def test_libpath_empty():
    with pytest.raises(OSError):
        foo = MBus.MBus(libpath='')
コード例 #5
0
def test_libpath_shared_object_only():
    with pytest.raises(OSError):
        foo = MBus.MBus(libpath='libmbus.so')
コード例 #6
0
def test_port_float():
    with pytest.raises(TypeError):
        MBus.MBus(host="127.0.0.1", port=2.3)
コード例 #7
0
def test_port_string():
    with pytest.raises(TypeError):
        MBus.MBus(host="127.0.0.1", port="123")
コード例 #8
0
def test_port_too_low():
    with pytest.raises(ValueError):
        MBus.MBus(host="127.0.0.1", port=-1)
コード例 #9
0
def test_port_too_high():
    with pytest.raises(ValueError):
        MBus.MBus(host="127.0.0.1", port=77777)
コード例 #10
0
def test_device_and_host():
    with pytest.raises(BaseException):
        foo = MBus.MBus(device='/dev/null', host='127.0.0.1')
コード例 #11
0
def test_port():
    foo = MBus.MBus(host="127.0.0.1", port=1234)
コード例 #12
0
def test_device_serial(pytestconfig):
    if '/dev/adjustme' == pytestconfig.getini('serialdevice'):
        pytest.skip("serial device not configured")
    with pytest.raises(TypeError):
        foo = MBus.MBus(device=pytestconfig.getini('serialdevice'))
コード例 #13
0
def test_device_nonexistent():
    with pytest.raises(FileNotFoundError):
        foo = MBus.MBus(device='/dev/idonotexist')
コード例 #14
0
def test_device_null():
    with pytest.raises(TypeError):
        foo = MBus.MBus(device='/dev/null')
コード例 #15
0
def test_invalid_argument():
    with pytest.raises(TypeError):
        foo = MBus.MBus(foo='bar')
コード例 #16
0
def test_empty_init():
    with pytest.raises(BaseException):
        foo = MBus.MBus()