Martin Panter added the comment:

I don’t understand why we have so many tests that assign the server port in the 
server thread, and then use some sort of synchronization to get it to the 
client thread. IMO it would be simpler in this case to do something like:

def setUp(self):
    serv = DOCXMLRPCServer(...)
    self.addCleanup(serv.server_close)
    [_, PORT] = serv.server_address  # Eliminates “ready“ event
    # Other server setup here
    thread = threading.Thread(target=serv.serve_forever)
    thread.start()
    self.addCleanup(thread.join)  # Instead of self.evt
    self.addCleanup(serv.shutdown)
    self.client = httplib.HTTPConnection("localhost:%d" % PORT)
    self.addCleanup(self.client.close)

----------
components: +Tests -Library (Lib)
nosy: +martin.panter
stage:  -> patch review
versions:  -Python 3.2, Python 3.3, Python 3.4

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

Reply via email to