def test_serverStopped(): print("Client test access value when Server stopped:", end=" ") try: # with contextlib.redirect_stdout(None): c = SharedMemory("test8", "azerty", log="./test_server.log", client=True) s = SharedMemory("test8", log="./test_server.log", client=False) s.close() c.setValue("toto") assert c.getValue() == None assert c[0] == None c.restart() c.setValue("toto") assert c.getValue() == "toto" assert c[0] == "toto" s.restart() assert s.getValue() == "toto" assert s[0] == "toto" c.close() s.close() print("SUCCESSED") except: print("FAILED") assert False
def test_call2(): print("Stop Client 3:", end=" ") try: # with contextlib.redirect_stdout(None): c = SharedMemory("test13", 1, log='./test_client.log', client=True) c.restart() c.close() assert True print("SUCCESSED") except: print("FAILED") assert False
def test_valueAccess(): print("Deleting value from overloaded method:", end=" ") try: # with contextlib.redirect_stdout(None): c = SharedMemory("test13", { '0': 0, '1': 1, '2': 2, '3': 3 }, log='./test_client.log', client=True) c.restart() del c['0'] c.close() assert True print("SUCCESSED") except: print("FAILED") assert False