Fixed test failures caused after test_irclib.py runs, and added a couple extra asserts and some commented out lines for more predictable test order.

This commit is contained in:
Jeremy Fincher 2005-02-18 18:31:44 +00:00
parent cf760c0401
commit 06feea3ae7
2 changed files with 14 additions and 7 deletions

View File

@ -36,7 +36,11 @@ load = unittest.defaultTestLoader.loadTestsFromModule
GLOBALS = globals()
dirname = os.path.dirname(__file__)
for filename in os.listdir(dirname):
filenames = os.listdir(dirname)
# Uncomment these if you need some consistency in the order these tests run.
# filenames.sort()
# filenames.reverse()
for filename in filenames:
if filename.startswith('test_') and filename.endswith('.py'):
name = filename[:-3]
exec 'import %s' % name in GLOBALS

View File

@ -368,8 +368,12 @@ class IrcStateTestCase(SupyTestCase):
class IrcTestCase(SupyTestCase):
def setUp(self):
self.irc = irclib.Irc('test')
_ = self.irc.takeMsg() # NICK
_ = self.irc.takeMsg() # USER
#m = self.irc.takeMsg()
#self.failUnless(m.command == 'PASS', 'Expected PASS, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'NICK', 'Expected NICK, got %r.' % m)
m = self.irc.takeMsg()
self.failUnless(m.command == 'USER', 'Expected USER, got %r.' % m)
def testPingResponse(self):
self.irc.feedMsg(ircmsgs.ping('123'))
@ -482,10 +486,9 @@ class IrcCallbackTestCase(SupyTestCase):
expected.insert(0, ircmsgs.password(password))
self.assertEqual(msgs, expected)
finally:
conf.supybot.nick.setValue(nick)
conf.supybot.user.setValue(user)
conf.supybot.networks.test.password.setValue(password)
conf.supybot.nick.setValue(nick)
conf.supybot.nick.setValue(originalNick)
conf.supybot.user.setValue(originalUser)
conf.supybot.networks.test.password.setValue(originalPassword)
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: