Martin Panter added the comment:

Thanks for reviewing, Serhiy. I am posting a new patch addressing the comments:

* Removed underscore from method name
* Made separate MockSslTests subclass, using a hacked ssl_context parameter to 
bypass the SSL module
* Separated asserts for closed socket and file objects

I have left the tests patching the “nntplib” module and inserting a mock 
“socket” module. Serhiy suggested patching the “socket” module directly, but 
that seems to be asking for trouble. Alternatives I can think of are:

* Go back to Rishi’s original code that uses a real socket in a background 
thread.
* Do the patching in a subprocess. But this is awkward if you want to reuse the 
existing NNTPv1Handler class in the subprocess. Suggestions or patches welcome 
:)
* Refactor the “nntplib” code specially to make it easier to test without a 
real socket and without patching

----------
Added file: http://bugs.python.org/file38515/issue22351_nntp_fail_5.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22351>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to