[Python-checkins] r62237 - python/trunk/Lib/test/test_httplib.py python/trunk/Lib/test/test_socket_ssl.py

trent.nelson python-checkins at python.org
Wed Apr 9 02:34:53 CEST 2008


Author: trent.nelson
Date: Wed Apr  9 02:34:53 2008
New Revision: 62237

Modified:
   python/trunk/Lib/test/test_httplib.py
   python/trunk/Lib/test/test_socket_ssl.py
Log:
Fix typo with regards to self.PORT shadowing class variables with the same name.

Modified: python/trunk/Lib/test/test_httplib.py
==============================================================================
--- python/trunk/Lib/test/test_httplib.py	(original)
+++ python/trunk/Lib/test/test_httplib.py	Wed Apr  9 02:34:53 2008
@@ -203,7 +203,7 @@
 
     def setUp(self):
         self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        self.PORT = test_support.bind_port(self.serv)
+        TimeoutTest.PORT = test_support.bind_port(self.serv)
         self.serv.listen(5)
 
     def tearDown(self):
@@ -215,13 +215,13 @@
         HTTPConnection and into the socket.
         '''
         # default
-        httpConn = httplib.HTTPConnection(HOST, self.PORT)
+        httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT)
         httpConn.connect()
         self.assertTrue(httpConn.sock.gettimeout() is None)
         httpConn.close()
 
         # a value
-        httpConn = httplib.HTTPConnection(HOST, self.PORT, timeout=30)
+        httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30)
         httpConn.connect()
         self.assertEqual(httpConn.sock.gettimeout(), 30)
         httpConn.close()
@@ -230,7 +230,8 @@
         previous = socket.getdefaulttimeout()
         socket.setdefaulttimeout(30)
         try:
-            httpConn = httplib.HTTPConnection(HOST, self.PORT, timeout=None)
+            httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT,
+                                              timeout=None)
             httpConn.connect()
         finally:
             socket.setdefaulttimeout(previous)

Modified: python/trunk/Lib/test/test_socket_ssl.py
==============================================================================
--- python/trunk/Lib/test/test_socket_ssl.py	(original)
+++ python/trunk/Lib/test/test_socket_ssl.py	Wed Apr  9 02:34:53 2008
@@ -212,8 +212,8 @@
         try:
             # XXX TODO: on Windows, this should make more effort to use the
             # openssl.exe that would have been built by the pcbuild.sln.
-            self.PORT = test_support.find_unused_port()
-            args = (self.PORT, cert_file, key_file)
+            OpenSSLServer.PORT = test_support.find_unused_port()
+            args = (OpenSSLServer.PORT, cert_file, key_file)
             cmd = "openssl s_server -accept %d -cert %s -key %s -quiet" % args
             self.s = subprocess.Popen(cmd.split(), stdin=subprocess.PIPE,
                                        stdout=subprocess.PIPE,
@@ -225,7 +225,7 @@
             # let's try if it is actually up
             try:
                 s = socket.socket()
-                s.connect((HOST, self.PORT))
+                s.connect((HOST, OpenSSLServer.PORT))
                 s.close()
                 if self.s.stdout.readline() != "ERROR\n":
                     raise ValueError


More information about the Python-checkins mailing list