From f7520dc0d7b4965f2c23a734ab48d472553d3b06 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 19 Apr 2013 04:23:09 +0300 Subject: Fix uploadTestCase to work even when HTTPSConnection is not available. --- Lib/distutils/tests/test_upload.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py index d269686..4a71ca4 100644 --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -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 -- cgit v0.12