summaryrefslogtreecommitdiffstats
path: root/test/option
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-04-26 18:49:06 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-04-26 18:49:06 (GMT)
commit28b036c0f803c2a156de7e155daa0f8635e95d89 (patch)
treef4c4ceb24a3fe3001dc394e833731ebdfbcca208 /test/option
parent186b632fd20283e821b6a65c72772635017945fb (diff)
downloadSCons-28b036c0f803c2a156de7e155daa0f8635e95d89.zip
SCons-28b036c0f803c2a156de7e155daa0f8635e95d89.tar.gz
SCons-28b036c0f803c2a156de7e155daa0f8635e95d89.tar.bz2
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Apply all the remaining changes from the fixers.
Diffstat (limited to 'test/option')
-rw-r--r--test/option/profile.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/option/profile.py b/test/option/profile.py
index 16032fb..fef4b7a 100644
--- a/test/option/profile.py
+++ b/test/option/profile.py
@@ -23,8 +23,21 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import StringIO
import sys
+try:
+ # In Python 2.5 and before, there was no 'io' module. The 'io' module
+ # in 2.6 provides a StringIO, but it only works with Unicode strings,
+ # while virtually all the strings we use are normal eight-bit strings,
+ # including all the strings generated by the 'profile' module. This
+ # is a horrible hack that just papers over the problem without fixing
+ # it, but I don't see any other way to do it. We'll keep using the old
+ # StringIO module until it no longer exists, and hope that if it's not
+ # there, it means that we've converted to Python 3.x where all strings
+ # are Unicode.
+ exec('from cStringIO import StringIO')
+except ImportError:
+ # No 'cStringIO' assume new 3.x structure
+ from io import StringIO
import TestSCons
@@ -48,7 +61,7 @@ test.must_contain_all_lines(test.stdout(), ['usage: scons [OPTION]'])
try:
save_stdout = sys.stdout
- sys.stdout = StringIO.StringIO()
+ sys.stdout = StringIO()
stats = pstats.Stats(scons_prof)
stats.sort_stats('time')
@@ -69,7 +82,7 @@ test.run(arguments = "--profile %s" % scons_prof)
try:
save_stdout = sys.stdout
- sys.stdout = StringIO.StringIO()
+ sys.stdout = StringIO()
stats = pstats.Stats(scons_prof)
stats.sort_stats('time')