[issue26173] test_ssl.bad_cert_test() exception handling

Martin Panter report at bugs.python.org
Wed Jan 27 20:24:36 EST 2016


Martin Panter added the comment:

There are more mistakes in the history of test_nonexisting_cert(). In revision 8a281bfc058d (Python 2.6), the method was added as testWrongCert(), with an existing but non-matching certificate file. But when this was ported to Python 3 in r66311, the wrongcert.pem file was not added, so Python 3 was actually testing the behaviour when the specified certificate file was missing. Then in r80596, the test method was renamed and a comment added assuming the Python 3 version with the missing file. However we already test the behaviour of missing files in test_errors().

I do not understand the ECONNRESET failure on Windows. Perhaps there is a race to do with the server closing the connection when the client should be reporting a certificate mismatch. It seems like a bug, and I suspect r80534 is not the correct fix. But I’m not in a position to investigate so I will leave that code as it is.

For Python 2 I propose wrong-cert-py2.patch:

* Rename WRONGCERT → NONEXISTINGCERT, not to be confused with wrongcert.pem
* Repurpose test_nonexisting_cert() → test_wrong_cert()
* Remove ENOENT exception handling from bad_cert_test()

----------
Added file: http://bugs.python.org/file41735/wrong-cert-py2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26173>
_______________________________________


More information about the Python-bugs-list mailing list