fix test_serverStopsWhileConnected

This commit is contained in:
Bastian Schroll 2019-10-20 17:37:37 +02:00
parent 13fc8460b2
commit 0445dc38cc
2 changed files with 8 additions and 3 deletions

View file

@ -122,5 +122,7 @@ class TCPClient:
self._sock.sendall(bytes(header + aliveMsg, "utf-8"))
return True
except (AttributeError, BrokenPipeError):
logging.exception("Unknown error: ")
except ConnectionResetError:
pass
return False

View file

@ -164,9 +164,12 @@ def test_serverStopsWhileConnected(getRunningServer, getClient):
"""!Shutdown server while client is connected"""
getClient.connect()
getRunningServer.stop()
time.sleep(0.1)
assert getClient.isConnected # todo check why the first always return true here
assert not getClient.isConnected
timeout = 10
while getClient.isConnected:
print(timeout)
timeout = timeout - 1
if timeout is 0:
assert 0
@pytest.mark.skip("needs fixture for more than one client")