Mercurial > p > roundup > code
diff test/test_cgi.py @ 5418:55f09ca366c4
Python 3 preparation: StringIO.
This generally arranges for StringIO and cStringIO references to use
io.StringIO for Python 3 but io.BytesIO for Python 2, consistent with
the string representations generally used in Roundup. A special
FasterStringIO in the TAL code, which referenced internals of the old
Python 2 StringIO module, is cut down so it doesn't actually do
anything beyond the StringIO class it inherits from (it would also be
reasonable to remove FasterStringIO completely). One place in
roundup_server.py clearly needing binary I/O is made to use io.BytesIO
unconditionally.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Wed, 25 Jul 2018 09:08:29 +0000 |
| parents | d26921b851c3 |
| children | 2b4f606d8e72 |
line wrap: on
line diff
--- a/test/test_cgi.py Wed Jul 25 09:07:03 2018 +0000 +++ b/test/test_cgi.py Wed Jul 25 09:08:29 2018 +0000 @@ -9,7 +9,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. from __future__ import print_function -import unittest, os, shutil, errno, sys, difflib, cgi, re, StringIO +import unittest, os, shutil, errno, sys, difflib, cgi, re from roundup.cgi import client, actions, exceptions from roundup.cgi.exceptions import FormError, NotFound @@ -18,6 +18,7 @@ from roundup.cgi.templating import HTMLProperty, _HTMLItem, anti_csrf_nonce from roundup.cgi.form_parser import FormParser from roundup import init, instance, password, hyperdb, date +from roundup.anypy.strings import StringIO # For testing very simple rendering from roundup.cgi.engine_zopetal import RoundupPageTemplate @@ -1458,7 +1459,7 @@ cl = self._make_client({'@columns': 'id,name'}, nodeid=None, userid='1') cl.classname = 'status' - output = StringIO.StringIO() + output = StringIO() cl.request = MockNull() cl.request.wfile = output actions.ExportCSVAction(cl).handle() @@ -1471,7 +1472,7 @@ cl = self._make_client({'@columns': 'falseid,name'}, nodeid=None, userid='1') cl.classname = 'status' - output = StringIO.StringIO() + output = StringIO() cl.request = MockNull() cl.request.wfile = output self.assertRaises(exceptions.NotFound, @@ -1481,7 +1482,7 @@ cl = self._make_client({'@columns': 'id,email,password'}, nodeid=None, userid='2') cl.classname = 'user' - output = StringIO.StringIO() + output = StringIO() cl.request = MockNull() cl.request.wfile = output # used to be self.assertRaises(exceptions.Unauthorised, @@ -1496,7 +1497,7 @@ cl = self._make_client({'@columns': 'id,address,password'}, nodeid=None, userid='2') cl.classname = 'user' - output = StringIO.StringIO() + output = StringIO() cl.request = MockNull() cl.request.wfile = output # used to be self.assertRaises(exceptions.Unauthorised,
