Commit 88e7a72a authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Merge #2888

Fix failure to connect in msgq tests.
parents 0d8a7d1e bd65ec46
...@@ -72,12 +72,21 @@ class MsgqRunTest(unittest.TestCase): ...@@ -72,12 +72,21 @@ class MsgqRunTest(unittest.TestCase):
# Start msgq # Start msgq
self.__msgq = subprocess.Popen([MSGQ_PATH, '-s', SOCKET_PATH], self.__msgq = subprocess.Popen([MSGQ_PATH, '-s', SOCKET_PATH],
close_fds=True) close_fds=True)
# Wait for it to become ready (up to the alarm-set timeout)
while not os.path.exists(SOCKET_PATH):
# Just a short wait, so we don't hog CPU, but don't wait too long
# Some testing data # Some testing data
self.__no_recpt = {"result": [-1, "No such recipient"]} self.__no_recpt = {"result": [-1, "No such recipient"]}
# Wait for it to become ready (up to the alarm-set timeout)
connection = None
while not connection:
# If the msgq is ready, this'll succeed. If not, it'll throw
# session error.
connection =
time.sleep(0.1) # Retry after a short time
# We have the connection now, that means it works. Close this
# connection, we won't use it. Each test gets enough new connections
# of its own.
def __message(self, data): def __message(self, data):
""" """
...@@ -67,7 +67,9 @@ class Session: ...@@ -67,7 +67,9 @@ class Session:
self._lname) self._lname)
except socket.error as se: except socket.error as se:
raise SessionError(se) if self._socket:
raise SessionError(se)
@property @property
def lname(self): def lname(self):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment