1. mirror
  2. cpython

Commits

Ezio Melotti  committed 1c2089c

Fix uploadTestCase to work even when HTTPSConnection is not available.

  • Participants
  • Parent commits 465cb5c
  • Branches default

Comments (0)

Files changed (1)

File Lib/distutils/tests/test_upload.py

View file
 
     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