summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/SCons/SubstTests.py4
-rw-r--r--src/engine/SCons/UtilTests.py9
-rw-r--r--test/Subst/TypeError.py2
-rw-r--r--test/option/profile.py10
4 files changed, 17 insertions, 8 deletions
diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py
index e1cd833..4568528 100644
--- a/src/engine/SCons/SubstTests.py
+++ b/src/engine/SCons/SubstTests.py
@@ -550,8 +550,10 @@ class scons_subst_TestCase(SubstTestCase):
expect = [
# Python 2.3, 2.4
"TypeError `unsubscriptable object' trying to evaluate `${NONE[2]}'",
- # Python 2.5 and later
+ # Python 2.5, 2.6
"TypeError `'NoneType' object is unsubscriptable' trying to evaluate `${NONE[2]}'",
+ # Python 2.7 and later
+ "TypeError `'NoneType' object is not subscriptable' trying to evaluate `${NONE[2]}'",
]
assert str(e) in expect, e
else:
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index 3f65456..a1e6756 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -668,7 +668,7 @@ class UtilTestCase(unittest.TestCase):
def test_LogicalLines(self):
"""Test the LogicalLines class"""
- fobj = io.StringIO(r"""
+ content = r"""
foo \
bar \
baz
@@ -676,7 +676,12 @@ foo
bling \
bling \ bling
bling
-""")
+"""
+ try:
+ fobj = io.StringIO(content)
+ except TypeError:
+ # Python 2.7 and beyond require unicode strings.
+ fobj = io.StringIO(unicode(content))
lines = LogicalLines(fobj).readlines()
assert lines == [
diff --git a/test/Subst/TypeError.py b/test/Subst/TypeError.py
index ed000fd..a996a77 100644
--- a/test/Subst/TypeError.py
+++ b/test/Subst/TypeError.py
@@ -35,7 +35,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
-expect_build = r"""scons: \*\*\*%s TypeError `(unsubscriptable object|'NoneType' object is unsubscriptable)' trying to evaluate `%s'
+expect_build = r"""scons: \*\*\*%s TypeError `(unsubscriptable object|'NoneType' object is (not |un)subscriptable)' trying to evaluate `%s'
"""
expect_read = "\n" + expect_build + TestSCons.file_expr
diff --git a/test/option/profile.py b/test/option/profile.py
index 5a4b392..d53c690 100644
--- a/test/option/profile.py
+++ b/test/option/profile.py
@@ -25,16 +25,18 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
try:
- from io import StringIO as _StringIO
+ import io
+ _StringIO = io.StringIO
except (ImportError, AttributeError):
# Pre-2.6 Python has no "io" module.
exec('from cStringIO import StringIO')
else:
- # TODO(2.6): The 2.6 io.StringIO.write() method requires unicode strings.
- # This subclass can be removed when we drop support for Python 2.6.
+ # TODO(2.6): In 2.6 and beyond, the io.StringIO.write() method
+ # requires unicode strings. This subclass can probably be removed
+ # when we drop support for Python 2.6.
class StringIO(_StringIO):
def write(self, s):
- super(_StringIO, self).write(unicode(s))
+ _StringIO.write(self, unicode(s))
import TestSCons