Bug 1503: Get the test to pass on OSX. This should make the test more

reliable, but I'm not convinced it is the right solution.  We need
to determine if this causes the test to hang on any platforms or do
other bad things.

Even if it gets the test to pass reliably, it might be that we want
to fix this in socket.  The socket returned from accept() is different
on different platforms (inheriting attributes or not) and we might
want to ensure that the attributes (at least blocking) is the same
across all platforms.
This commit is contained in:
Neal Norwitz 2008-03-28 06:34:03 +00:00
parent 9fdfaaf9af
commit 70cea58c84
1 changed files with 10 additions and 2 deletions

View File

@ -273,8 +273,16 @@ def http_server(evt, numrequests):
'''This is my function''' '''This is my function'''
return True return True
class MyXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):
def get_request(self):
# Ensure the socket is always non-blocking. On Linux, socket
# attributes are not inherited like they are on *BSD and Windows.
s, port = self.socket.accept()
s.setblocking(True)
return s, port
try: try:
serv = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 0), serv = MyXMLRPCServer(("localhost", 0),
logRequests=False, bind_and_activate=False) logRequests=False, bind_and_activate=False)
serv.socket.settimeout(3) serv.socket.settimeout(3)
serv.server_bind() serv.server_bind()