https://travis-ci.org/wikimedia/pywikibot-core/jobs/214732977#L4224
________________ HttpsCertificateTestCase.test_https_cert_error ________________ self = <tests.http_tests.HttpsCertificateTestCase testMethod=test_https_cert_error> def test_https_cert_error(self): """Test if http.fetch respects disable_ssl_certificate_validation.""" self.assertRaisesRegex(pywikibot.FatalServerError, self.CERT_VERIFY_FAILED_RE, http.fetch, uri='https://testssl-expire-r2i2.disig.sk/index.en.html') http.session.close() # clear the connection with warnings.catch_warnings(record=True) as warning_log: response = http.fetch( uri='https://testssl-expire-r2i2.disig.sk/index.en.html', disable_ssl_certificate_validation=True) r = response.content self.assertIsInstance(r, unicode) self.assertTrue(re.search(r'<title>.*</title>', r)) http.session.close() # clear the connection # Verify that it now fails again self.assertRaisesRegex(pywikibot.FatalServerError, self.CERT_VERIFY_FAILED_RE, http.fetch, uri='https://testssl-expire-r2i2.disig.sk/index.en.html') http.session.close() # clear the connection # Verify that the warning occurred > self.assertEqual(len(warning_log), 1) E AssertionError: 2 != 1
According to L1566 the warnings are:
tests/http_tests.py::HttpsCertificateTestCase::test_https_cert_error WARNING: /home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/_pytest/_code/source.py:343: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('172.17.0.4', 47346), raddr=('195.28.75.37', 443)> astnode = compile(content, "source", "exec", 1024) # 1024 for AST FAILED
We had a similar issue in T151248: test_https_cert_error failed on Travis CI