From: R David Murray Date: Mon, 2 May 2011 12:47:24 +0000 (-0400) Subject: I was right, hardconding the localhost IP doesn't work in linux-vserver. X-Git-Tag: v3.2.1b1~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b912c5a004068e472b1b46fad68445e70934e280;p=thirdparty%2FPython%2Fcpython.git I was right, hardconding the localhost IP doesn't work in linux-vserver. --- diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py index 4651f376f6ed..884529f54275 100644 --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -290,8 +290,7 @@ class DebuggingServerTests(unittest.TestCase): self.serv_evt.wait() self.output.flush() # Add the X-Peer header that DebuggingServer adds - # XXX: I'm not sure hardcoding this IP will work on linux-vserver. - m['X-Peer'] = '127.0.0.1' + m['X-Peer'] = socket.gethostbyname('localhost') mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) self.assertEqual(self.output.getvalue(), mexpect) @@ -311,8 +310,7 @@ class DebuggingServerTests(unittest.TestCase): self.serv_evt.wait() self.output.flush() # Add the X-Peer header that DebuggingServer adds - # XXX: I'm not sure hardcoding this IP will work on linux-vserver. - m['X-Peer'] = '127.0.0.1' + m['X-Peer'] = socket.gethostbyname('localhost') # The Bcc header is deleted before serialization. del m['Bcc'] mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) @@ -341,8 +339,7 @@ class DebuggingServerTests(unittest.TestCase): self.serv_evt.wait() self.output.flush() # Add the X-Peer header that DebuggingServer adds - # XXX: I'm not sure hardcoding this IP will work on linux-vserver. - m['X-Peer'] = '127.0.0.1' + m['X-Peer'] = socket.gethostbyname('localhost') mexpect = '%s%s\n%s' % (MSG_BEGIN, m.as_string(), MSG_END) self.assertEqual(self.output.getvalue(), mexpect) debugout = smtpd.DEBUGSTREAM.getvalue()