def test_connection2(): print("Create Server instance with Client(after):", end=" ") try: # with contextlib.redirect_stdout(None): c = SharedMemory("test27", "azerty", log="./test_server.log", client=True) s = SharedMemory("test27", log="./test_server.log", client=False) res = c.getAvailability() and s.getAvailability() c.close() s.close() assert res print("SUCCESSED") except: print("FAILED") assert False
def test_availability(): print("Check availability for Client and Server:", end=" ") try: # with contextlib.redirect_stdout(None): c = SharedMemory("test10", "azerty", log="./test_server.log", client=True) s = SharedMemory("test10", log="./test_server.log", client=False) res1 = c.getAvailability() == True res2 = s.getAvailability() == True s.close() c.close() assert res1 assert res2 print("SUCCESSED") except: print("FAILED") assert False
def test_serverFirst(): print("Create Server first:", end=" ") try: # with contextlib.redirect_stdout(None): s = SharedMemory("test10", log="./test_server.log", client=False) c = SharedMemory("test10", "azerty", log="./test_server.log", client=True) res1 = c.getAvailability() == True res2 = s.getAvailability() == True assert res1 assert res2 assert s.getValue() == c.getValue() s.close() c.close() print("SUCCESSED") except: print("FAILED") assert False