From 6b7db2e9f1069a0d99e69eac39c965645cfe8fa7 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Thu, 27 Dec 2012 11:05:04 +0000 Subject: [PATCH] test_irclib: Make use of context for maxHistoryLength. --- test/test_irclib.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/test_irclib.py b/test/test_irclib.py index f0f93d8ab..8190ff5cd 100644 --- a/test/test_irclib.py +++ b/test/test_irclib.py @@ -1,4 +1,4 @@ -### +## # Copyright (c) 2002-2005, Jeremiah Fincher # All rights reserved. # @@ -261,9 +261,7 @@ class IrcStateTestCase(SupyTestCase): if len(msgs) < 10: return maxHistoryLength = conf.supybot.protocols.irc.maxHistoryLength - oldconfmaxhistory = maxHistoryLength() - try: - maxHistoryLength.setValue(10) + with maxHistoryLength.context(10): state = irclib.IrcState() for msg in msgs: try: @@ -274,8 +272,6 @@ class IrcStateTestCase(SupyTestCase): self.assertEqual(len(state.history), maxHistoryLength()) self.assertEqual(list(state.history), msgs[len(msgs) - maxHistoryLength():]) - finally: - maxHistoryLength.setValue(oldconfmaxhistory) def testWasteland005(self): state = irclib.IrcState()