def mbus_tcp(): return MBus.MBus(host="127.0.0.1")
def test_libpath_shared_object_path(): foo = MBus.MBus(libpath="/usr/local/lib/libmbus.so", host="127.0.0.1")
def mbus_tcp_connected(): tmp = MBus.MBus(host="127.0.0.1") return tmp.connect()
def test_libpath_empty(): with pytest.raises(OSError): foo = MBus.MBus(libpath='')
def test_libpath_shared_object_only(): with pytest.raises(OSError): foo = MBus.MBus(libpath='libmbus.so')
def test_port_float(): with pytest.raises(TypeError): MBus.MBus(host="127.0.0.1", port=2.3)
def test_port_string(): with pytest.raises(TypeError): MBus.MBus(host="127.0.0.1", port="123")
def test_port_too_low(): with pytest.raises(ValueError): MBus.MBus(host="127.0.0.1", port=-1)
def test_port_too_high(): with pytest.raises(ValueError): MBus.MBus(host="127.0.0.1", port=77777)
def test_device_and_host(): with pytest.raises(BaseException): foo = MBus.MBus(device='/dev/null', host='127.0.0.1')
def test_port(): foo = MBus.MBus(host="127.0.0.1", port=1234)
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'))
def test_device_nonexistent(): with pytest.raises(FileNotFoundError): foo = MBus.MBus(device='/dev/idonotexist')
def test_device_null(): with pytest.raises(TypeError): foo = MBus.MBus(device='/dev/null')
def test_invalid_argument(): with pytest.raises(TypeError): foo = MBus.MBus(foo='bar')
def test_empty_init(): with pytest.raises(BaseException): foo = MBus.MBus()