testStarNick: Replace unreliable workaround for irc2

This commit is contained in:
Valentin Lorentz 2022-06-26 16:37:47 +02:00
parent 601f49a9ef
commit 6b6017b40c

View File

@ -2,10 +2,13 @@
Regression tests for bugs in `Ergo <https://ergo.chat/>`_. Regression tests for bugs in `Ergo <https://ergo.chat/>`_.
""" """
import time
from irctest import cases, runner from irctest import cases, runner
from irctest.numerics import ERR_ERRONEUSNICKNAME, ERR_NICKNAMEINUSE, RPL_WELCOME from irctest.numerics import (
ERR_ERRONEUSNICKNAME,
ERR_NICKNAMEINUSE,
RPL_HELLO,
RPL_WELCOME,
)
from irctest.patma import ANYDICT from irctest.patma import ANYDICT
@ -111,8 +114,7 @@ class RegressionsTestCase(cases.BaseServerTestCase):
self.sendLine(1, "NICK *") self.sendLine(1, "NICK *")
self.sendLine(1, "USER u s e r") self.sendLine(1, "USER u s e r")
replies = {"NOTICE"} replies = {"NOTICE"}
time.sleep(2) # give time to slow servers, like irc2 to reply while replies <= {"NOTICE", RPL_HELLO}:
while replies == {"NOTICE"}:
replies = set(msg.command for msg in self.getMessages(1, synchronize=False)) replies = set(msg.command for msg in self.getMessages(1, synchronize=False))
self.assertIn(ERR_ERRONEUSNICKNAME, replies) self.assertIn(ERR_ERRONEUSNICKNAME, replies)
self.assertNotIn(RPL_WELCOME, replies) self.assertNotIn(RPL_WELCOME, replies)