Handle connection reset in selftest
[mudpy.git] / mudpy / tests / selftest.py
index 6239599..02d98a5 100644 (file)
@@ -260,6 +260,10 @@ def main():
                 index, match, received = lusers[conversant].expect(
                     [re.compile(question.encode("utf-8"), flags=re.DOTALL)], 5)
                 captures[conversant] += received.decode("utf-8")
                 index, match, received = lusers[conversant].expect(
                     [re.compile(question.encode("utf-8"), flags=re.DOTALL)], 5)
                 captures[conversant] += received.decode("utf-8")
+            except ConnectionResetError:
+                print("ERROR: Unable to connect to server.")
+                success = False
+                break
             except EOFError:
                 print("ERROR: luser%s premature disconnection expecting:\n\n"
                       "%s\n\n"
             except EOFError:
                 print("ERROR: luser%s premature disconnection expecting:\n\n"
                       "%s\n\n"