[Python-checkins] cpython: #19662: Eliminate warnings in other test modules that use smtpd.

r.david.murray python-checkins at python.org
Wed Jun 11 18:27:58 CEST 2014


http://hg.python.org/cpython/rev/a6c846ec5fd3
changeset:   91133:a6c846ec5fd3
user:        R David Murray <rdmurray at bitdance.com>
date:        Wed Jun 11 12:27:40 2014 -0400
summary:
  #19662: Eliminate warnings in other test modules that use smtpd.

Eventually these will want to convert to decode_data=False, I think.

files:
  Lib/test/test_logging.py |  3 ++-
  Lib/test/test_smtplib.py |  8 +++++---
  2 files changed, 7 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -679,7 +679,8 @@
         """
 
         def __init__(self, addr, handler, poll_interval, sockmap):
-            smtpd.SMTPServer.__init__(self, addr, None, map=sockmap)
+            smtpd.SMTPServer.__init__(self, addr, None, map=sockmap,
+                                      decode_data=True)
             self.port = self.socket.getsockname()[1]
             self._handler = handler
             self._thread = None
diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py
--- a/Lib/test/test_smtplib.py
+++ b/Lib/test/test_smtplib.py
@@ -184,7 +184,8 @@
         self.old_DEBUGSTREAM = smtpd.DEBUGSTREAM
         smtpd.DEBUGSTREAM = io.StringIO()
         # Pick a random unused port by passing 0 for the port number
-        self.serv = smtpd.DebuggingServer((HOST, 0), ('nowhere', -1))
+        self.serv = smtpd.DebuggingServer((HOST, 0), ('nowhere', -1),
+                                          decode_data=True)
         # Keep a note of what port was assigned
         self.port = self.serv.socket.getsockname()[1]
         serv_args = (self.serv, self.serv_evt, self.client_evt)
@@ -719,7 +720,8 @@
 
     def handle_accepted(self, conn, addr):
         self._SMTPchannel = self.channel_class(
-            self._extra_features, self, conn, addr)
+            self._extra_features, self, conn, addr,
+            decode_data=self._decode_data)
 
     def process_message(self, peer, mailfrom, rcpttos, data):
         pass
@@ -742,7 +744,7 @@
         self.serv_evt = threading.Event()
         self.client_evt = threading.Event()
         # Pick a random unused port by passing 0 for the port number
-        self.serv = SimSMTPServer((HOST, 0), ('nowhere', -1))
+        self.serv = SimSMTPServer((HOST, 0), ('nowhere', -1), decode_data=True)
         # Keep a note of what port was assigned
         self.port = self.serv.socket.getsockname()[1]
         serv_args = (self.serv, self.serv_evt, self.client_evt)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list