summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_wsgiref.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2007-08-10 19:13:33 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2007-08-10 19:13:33 (GMT)
commite6b59c5550227505dfc787ebec605e51e50a6e46 (patch)
tree85107420f0ddb26870dd326c4b78f8e6a52f9666 /Lib/test/test_wsgiref.py
parent7ffe2998cdc5bb78a5301d3a2a137042b1cf088e (diff)
downloadcpython-e6b59c5550227505dfc787ebec605e51e50a6e46.zip
cpython-e6b59c5550227505dfc787ebec605e51e50a6e46.tar.gz
cpython-e6b59c5550227505dfc787ebec605e51e50a6e46.tar.bz2
Make sure the mock object passed to finish_request() is buffered.
Diffstat (limited to 'Lib/test/test_wsgiref.py')
-rwxr-xr-xLib/test/test_wsgiref.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
index 544e42b..bcf6352 100755
--- a/Lib/test/test_wsgiref.py
+++ b/Lib/test/test_wsgiref.py
@@ -7,7 +7,7 @@ from wsgiref import util
from wsgiref.validate import validator
from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app
from wsgiref.simple_server import make_server
-from io import StringIO, BytesIO
+from io import StringIO, BytesIO, BufferedReader
from SocketServer import BaseServer
import re, sys
@@ -49,11 +49,13 @@ def hello_app(environ,start_response):
def run_amock(app=hello_app, data=b"GET / HTTP/1.0\n\n"):
server = make_server("", 80, app, MockServer, MockHandler)
- inp, out, err, olderr = BytesIO(data), StringIO(), StringIO(), sys.stderr
- sys.stderr = err
+ inp = BufferedReader(BytesIO(data))
+ out = StringIO()
+ olderr = sys.stderr
+ err = sys.stderr = StringIO()
try:
- server.finish_request((inp,out), ("127.0.0.1",8888))
+ server.finish_request((inp, out), ("127.0.0.1",8888))
finally:
sys.stderr = olderr