summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/UtilTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-04-07 13:16:57 (GMT)
committerSteven Knight <knight@baldmt.com>2010-04-07 13:16:57 (GMT)
commit32d7c315d62846ea8febadcbb2c60cf9e3382cbf (patch)
tree4d16f888d6f0de67d3dba1341b768df17d852b44 /src/engine/SCons/UtilTests.py
parentd63f3f799b9e015d4a77e5874fa4cc0c4efc511f (diff)
downloadSCons-32d7c315d62846ea8febadcbb2c60cf9e3382cbf.zip
SCons-32d7c315d62846ea8febadcbb2c60cf9e3382cbf.tar.gz
SCons-32d7c315d62846ea8febadcbb2c60cf9e3382cbf.tar.bz2
Issue 2332: Convert from using StringIO.StringIO class to using the
forward-compatible io.StringIO class, with the addition of an "io" compatibility module for Python versions before 2.6.
Diffstat (limited to 'src/engine/SCons/UtilTests.py')
-rw-r--r--src/engine/SCons/UtilTests.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index ad27127..fd7862c 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -23,9 +23,11 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
+import io
import os
import os.path
-import StringIO
import sys
import unittest
@@ -171,24 +173,24 @@ class UtilTestCase(unittest.TestCase):
try:
node, expect, withtags = self.tree_case_1()
- sys.stdout = StringIO.StringIO()
+ sys.stdout = io.StringIO()
print_tree(node, get_children)
actual = sys.stdout.getvalue()
assert expect == actual, (expect, actual)
- sys.stdout = StringIO.StringIO()
+ sys.stdout = io.StringIO()
print_tree(node, get_children, showtags=1)
actual = sys.stdout.getvalue()
assert withtags == actual, (withtags, actual)
node, expect, withtags = self.tree_case_2(prune=0)
- sys.stdout = StringIO.StringIO()
+ sys.stdout = io.StringIO()
print_tree(node, get_children, 1)
actual = sys.stdout.getvalue()
assert expect == actual, (expect, actual)
- sys.stdout = StringIO.StringIO()
+ sys.stdout = io.StringIO()
# The following call should work here:
# print_tree(node, get_children, 1, showtags=1)
# For some reason I don't understand, though, *this*
@@ -678,7 +680,7 @@ class UtilTestCase(unittest.TestCase):
def test_LogicalLines(self):
"""Test the LogicalLines class"""
- fobj = StringIO.StringIO(r"""
+ fobj = io.StringIO(r"""
foo \
bar \
baz