[Python-checkins] cpython: Fix uploadTestCase to work even when HTTPSConnection is not available.

ezio.melotti python-checkins at python.org
Fri Apr 19 03:23:20 CEST 2013


http://hg.python.org/cpython/rev/1c2089c58a37
changeset:   83444:1c2089c58a37
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Fri Apr 19 04:23:09 2013 +0300
summary:
  Fix uploadTestCase to work even when HTTPSConnection is not available.

files:
  Lib/distutils/tests/test_upload.py |  10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py
--- a/Lib/distutils/tests/test_upload.py
+++ b/Lib/distutils/tests/test_upload.py
@@ -72,13 +72,13 @@
 
     def setUp(self):
         super(uploadTestCase, self).setUp()
-        self.old_class = httpclient.HTTPSConnection
+        if hasattr(httpclient, 'HTTPSConnection'):
+            self.addCleanup(setattr, httpclient, 'HTTPSConnection',
+                            httpclient.HTTPSConnection)
+        else:
+            self.addCleanup(delattr, httpclient, 'HTTPSConnection')
         self.conn = httpclient.HTTPSConnection = FakeConnection()
 
-    def tearDown(self):
-        httpclient.HTTPSConnection = self.old_class
-        super(uploadTestCase, self).tearDown()
-
     def test_finalize_options(self):
 
         # new format

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


More information about the Python-checkins mailing list