def test_lock(): """ Test if the lock property can be used in a "with"-statement. """ port = ShdlcTcpPort('localhost', 0, do_open=False) with port.lock: port.socket_timeout = 1.0 # access port while locked
def test_socket_timeout(): """ Test if the socket_timeout property can be read and set. """ port = ShdlcTcpPort('localhost', 0, socket_timeout=5, do_open=False) assert type(port.socket_timeout) is float assert port.socket_timeout == 5.0 port.socket_timeout = 0.5 assert port.socket_timeout == 0.5