[Python-3000-checkins] r56906 - python/branches/py3k/Lib/test/test_wsgiref.py

jeremy.hylton python-3000-checkins at python.org
Fri Aug 10 21:13:34 CEST 2007


Author: jeremy.hylton
Date: Fri Aug 10 21:13:33 2007
New Revision: 56906

Modified:
   python/branches/py3k/Lib/test/test_wsgiref.py
Log:
Make sure the mock object passed to finish_request() is buffered.


Modified: python/branches/py3k/Lib/test/test_wsgiref.py
==============================================================================
--- python/branches/py3k/Lib/test/test_wsgiref.py	(original)
+++ python/branches/py3k/Lib/test/test_wsgiref.py	Fri Aug 10 21:13:33 2007
@@ -7,7 +7,7 @@
 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 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
 


More information about the Python-3000-checkins mailing list