Commit 6dc5ad10 authored by Denis Bilenko's avatar Denis Bilenko

lower timeouts in stdlib tests

parent 6f27a8b2
...@@ -46,9 +46,9 @@ def test(): ...@@ -46,9 +46,9 @@ def test():
if verbose: if verbose:
print "Can't test select easily on", sys.platform print "Can't test select easily on", sys.platform
return return
cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done'
p = os.popen(cmd, 'r') p = os.popen(cmd, 'r')
for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10:
if verbose: if verbose:
print 'timeout =', tout print 'timeout =', tout
rfd, wfd, xfd = select.select([p], [], [], tout) rfd, wfd, xfd = select.select([p], [], [], tout)
......
...@@ -23,7 +23,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer): ...@@ -23,7 +23,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
# Set the timeout of our listening socket really low so # Set the timeout of our listening socket really low so
# that we can stop the server easily. # that we can stop the server easily.
self.socket.settimeout(1.0) self.socket.settimeout(0.1)
def get_request(self): def get_request(self):
"""BaseHTTPServer method, overridden.""" """BaseHTTPServer method, overridden."""
...@@ -33,7 +33,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer): ...@@ -33,7 +33,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
# It's a loopback connection, so setting the timeout # It's a loopback connection, so setting the timeout
# really low shouldn't affect anything, but should make # really low shouldn't affect anything, but should make
# deadlocks less likely to occur. # deadlocks less likely to occur.
request.settimeout(10.0) request.settimeout(1.0)
return (request, client_address) return (request, client_address)
......
...@@ -35,9 +35,9 @@ class SelectTestCase(unittest.TestCase): ...@@ -35,9 +35,9 @@ class SelectTestCase(unittest.TestCase):
if test_support.verbose: if test_support.verbose:
print "can't easily test on this system" print "can't easily test on this system"
return return
cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done'
p = os.popen(cmd, 'r') p = os.popen(cmd, 'r')
for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10:
if test_support.verbose: if test_support.verbose:
print 'timeout =', tout print 'timeout =', tout
rfd, wfd, xfd = select.select([p], [], [], tout) rfd, wfd, xfd = select.select([p], [], [], tout)
......
...@@ -23,7 +23,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer): ...@@ -23,7 +23,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
# Set the timeout of our listening socket really low so # Set the timeout of our listening socket really low so
# that we can stop the server easily. # that we can stop the server easily.
self.socket.settimeout(1.0) self.socket.settimeout(0.1)
def get_request(self): def get_request(self):
"""BaseHTTPServer method, overridden.""" """BaseHTTPServer method, overridden."""
...@@ -33,7 +33,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer): ...@@ -33,7 +33,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
# It's a loopback connection, so setting the timeout # It's a loopback connection, so setting the timeout
# really low shouldn't affect anything, but should make # really low shouldn't affect anything, but should make
# deadlocks less likely to occur. # deadlocks less likely to occur.
request.settimeout(10.0) request.settimeout(1.0)
return (request, client_address) return (request, client_address)
......
...@@ -29,9 +29,9 @@ class SelectTestCase(unittest.TestCase): ...@@ -29,9 +29,9 @@ class SelectTestCase(unittest.TestCase):
self.assertIsNot(w, x) self.assertIsNot(w, x)
def test_select(self): def test_select(self):
cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 0.1; done'
p = os.popen(cmd, 'r') p = os.popen(cmd, 'r')
for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: for tout in (0, 0.1, 0.2, 0.4, 0.8, 1.6) + (None,)*10:
if test_support.verbose: if test_support.verbose:
print 'timeout =', tout print 'timeout =', tout
rfd, wfd, xfd = select.select([p], [], [], tout) rfd, wfd, xfd = select.select([p], [], [], tout)
......
...@@ -23,7 +23,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer): ...@@ -23,7 +23,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
# Set the timeout of our listening socket really low so # Set the timeout of our listening socket really low so
# that we can stop the server easily. # that we can stop the server easily.
self.socket.settimeout(1.0) self.socket.settimeout(0.1)
def get_request(self): def get_request(self):
"""BaseHTTPServer method, overridden.""" """BaseHTTPServer method, overridden."""
...@@ -33,7 +33,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer): ...@@ -33,7 +33,7 @@ class LoopbackHttpServer(BaseHTTPServer.HTTPServer):
# It's a loopback connection, so setting the timeout # It's a loopback connection, so setting the timeout
# really low shouldn't affect anything, but should make # really low shouldn't affect anything, but should make
# deadlocks less likely to occur. # deadlocks less likely to occur.
request.settimeout(10.0) request.settimeout(1.0)
return (request, client_address) return (request, client_address)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment