]> granicus.if.org Git - python/commitdiff
Fix uploadTestCase to work even when HTTPSConnection is not available.
authorEzio Melotti <ezio.melotti@gmail.com>
Fri, 19 Apr 2013 01:23:09 +0000 (04:23 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Fri, 19 Apr 2013 01:23:09 +0000 (04:23 +0300)
Lib/distutils/tests/test_upload.py

index d2696866fe216f1d8fd8beb9d06b75969241661d..4a71ca4a8d5690ac14062c459c18f0d81ca6b842 100644 (file)
@@ -72,13 +72,13 @@ class uploadTestCase(PyPIRCCommandTestCase):
 
     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