summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-08 17:01:45 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-08 17:01:45 (GMT)
commit6a10e02aa644ad7f9c1f2ab6dd249c1a414c0c8b (patch)
treef78dd670c175f469bb0c312d68ddb4b9ac3eabe7
parent0269b91030c87db7f0d3c735367ab7ea6277a918 (diff)
downloadcpython-6a10e02aa644ad7f9c1f2ab6dd249c1a414c0c8b.zip
cpython-6a10e02aa644ad7f9c1f2ab6dd249c1a414c0c8b.tar.gz
cpython-6a10e02aa644ad7f9c1f2ab6dd249c1a414c0c8b.tar.bz2
Switch wsgiref to io.{StringIO,BytesIO}. This shuts up the test failures.
(I'm not sure about it actually working though.)
-rwxr-xr-xLib/test/test_wsgiref.py6
-rw-r--r--Lib/wsgiref/simple_server.py2
-rw-r--r--Lib/wsgiref/util.py2
3 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
index 213c5cf..544e42b 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 StringIO import StringIO
+from io import StringIO, BytesIO
from SocketServer import BaseServer
import re, sys
@@ -47,9 +47,9 @@ def hello_app(environ,start_response):
])
return ["Hello, world!"]
-def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"):
+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 = StringIO(data), StringIO(), StringIO(), sys.stderr
+ inp, out, err, olderr = BytesIO(data), StringIO(), StringIO(), sys.stderr
sys.stderr = err
try:
diff --git a/Lib/wsgiref/simple_server.py b/Lib/wsgiref/simple_server.py
index abb3620..980f97a 100644
--- a/Lib/wsgiref/simple_server.py
+++ b/Lib/wsgiref/simple_server.py
@@ -163,7 +163,7 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):
def demo_app(environ,start_response):
- from StringIO import StringIO
+ from io import StringIO
stdout = StringIO()
print("Hello world!", file=stdout)
print(file=stdout)
diff --git a/Lib/wsgiref/util.py b/Lib/wsgiref/util.py
index 5b44eda..a4ca02f 100644
--- a/Lib/wsgiref/util.py
+++ b/Lib/wsgiref/util.py
@@ -149,7 +149,7 @@ def setup_testing_defaults(environ):
environ.setdefault('wsgi.multithread', 0)
environ.setdefault('wsgi.multiprocess', 0)
- from StringIO import StringIO
+ from io import StringIO
environ.setdefault('wsgi.input', StringIO(""))
environ.setdefault('wsgi.errors', StringIO())
environ.setdefault('wsgi.url_scheme',guess_scheme(environ))