#19662: Eliminate warnings in other test modules that use smtpd.

Eventually these will want to convert to decode_data=False, I think.
This commit is contained in:
R David Murray 2014-06-11 12:27:40 -04:00
parent 554bcbf1b9
commit 1144da5821
2 changed files with 7 additions and 4 deletions

View File

@ -679,7 +679,8 @@ if threading:
""" """
def __init__(self, addr, handler, poll_interval, sockmap): 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.port = self.socket.getsockname()[1]
self._handler = handler self._handler = handler
self._thread = None self._thread = None

View File

@ -184,7 +184,8 @@ class DebuggingServerTests(unittest.TestCase):
self.old_DEBUGSTREAM = smtpd.DEBUGSTREAM self.old_DEBUGSTREAM = smtpd.DEBUGSTREAM
smtpd.DEBUGSTREAM = io.StringIO() smtpd.DEBUGSTREAM = io.StringIO()
# Pick a random unused port by passing 0 for the port number # 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 # Keep a note of what port was assigned
self.port = self.serv.socket.getsockname()[1] self.port = self.serv.socket.getsockname()[1]
serv_args = (self.serv, self.serv_evt, self.client_evt) serv_args = (self.serv, self.serv_evt, self.client_evt)
@ -719,7 +720,8 @@ class SimSMTPServer(smtpd.SMTPServer):
def handle_accepted(self, conn, addr): def handle_accepted(self, conn, addr):
self._SMTPchannel = self.channel_class( 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): def process_message(self, peer, mailfrom, rcpttos, data):
pass pass
@ -742,7 +744,7 @@ class SMTPSimTests(unittest.TestCase):
self.serv_evt = threading.Event() self.serv_evt = threading.Event()
self.client_evt = threading.Event() self.client_evt = threading.Event()
# Pick a random unused port by passing 0 for the port number # 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 # Keep a note of what port was assigned
self.port = self.serv.socket.getsockname()[1] self.port = self.serv.socket.getsockname()[1]
serv_args = (self.serv, self.serv_evt, self.client_evt) serv_args = (self.serv, self.serv_evt, self.client_evt)