Fix test to not depend on warning order
MODIFY
test/with_dummyserver/test_https.py
test/with_dummyserver/test_https.py
@@ -279,14 +279,7 @@ class TestHTTPS(HTTPSDummyServerTestCase):
# the unverified warning. Older systems may also emit other
# warnings, which we want to ignore here.
calls = warn.call_args_list
- if sys.version_info >= (2, 7, 9) or util.IS_PYOPENSSL \
- or util.IS_SECURETRANSPORT:
- category = calls[0][0][1]
- elif util.HAS_SNI:
- category = calls[1][0][1]
- else:
- category = calls[2][0][1]
- self.assertEqual(category, InsecureRequestWarning)
+ self.assertIn(InsecureRequestWarning, [x[0][1] for x in calls])
def test_ssl_unverified_with_ca_certs(self):
pool = HTTPSConnectionPool(self.host, self.port,

Fix test to not depend on warning order