]> granicus.if.org Git - python/commitdiff
Restore smtpd.DEBUGSTREAM at the end of test_smtpd.
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 12 Nov 2011 19:36:29 +0000 (20:36 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 12 Nov 2011 19:36:29 +0000 (20:36 +0100)
This fixes a subsequent refleak in test_smtplib.

Lib/test/test_smtpd.py

index a4cd6707baf55ed1dd52de54abb1d983c4e335b0..68ccc29036af30860ca93058de794c4a369a51cf 100644 (file)
@@ -52,6 +52,7 @@ class SMTPDServerTest(TestCase):
 class SMTPDChannelTest(TestCase):
     def setUp(self):
         smtpd.socket = asyncore.socket = mock_socket
+        self.old_debugstream = smtpd.DEBUGSTREAM
         self.debug = smtpd.DEBUGSTREAM = io.StringIO()
         self.server = DummyServer('a', 'b')
         conn, addr = self.server.accept()
@@ -60,6 +61,7 @@ class SMTPDChannelTest(TestCase):
     def tearDown(self):
         asyncore.close_all()
         asyncore.socket = smtpd.socket = socket
+        smtpd.DEBUGSTREAM = self.old_debugstream
 
     def write_line(self, line):
         self.channel.socket.queue_recv(line)