summaryrefslogtreecommitdiffstats
path: root/QMTest
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 /QMTest
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 'QMTest')
-rw-r--r--QMTest/TestCmd.py24
-rw-r--r--QMTest/TestCommon.py10
2 files changed, 16 insertions, 18 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 1ee5d4e..1c71907 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -228,7 +228,12 @@ import sys
import tempfile
import time
import traceback
-import UserList
+try:
+ from collections import UserList, UserString
+except ImportError:
+ # no 'collections' module or no UserFoo in collections
+ exec('from UserList import UserList')
+ exec('from UserString import UserString')
try:
# pre-2.7 doesn't have the memoryview() built-in
@@ -264,24 +269,15 @@ except ImportError:
__all__.append('simple_diff')
def is_List(e):
- return isinstance(e, list) \
- or isinstance(e, UserList.UserList)
-
-try:
- from UserString import UserString
-except ImportError:
- class UserString:
- pass
+ return isinstance(e, (list,UserList))
-try: unicode
+try: eval('unicode')
except NameError:
def is_String(e):
- return isinstance(e, str) or isinstance(e, UserString)
+ return isinstance(e, (str,UserString))
else:
def is_String(e):
- return isinstance(e, str) \
- or isinstance(e, unicode) \
- or isinstance(e, UserString)
+ return isinstance(e, (str,unicode,UserString))
tempfile.template = 'testcmd.'
if os.name in ('posix', 'nt'):
diff --git a/QMTest/TestCommon.py b/QMTest/TestCommon.py
index fce0fc8..fcd3e70 100644
--- a/QMTest/TestCommon.py
+++ b/QMTest/TestCommon.py
@@ -95,10 +95,13 @@ __version__ = "0.37"
import copy
import os
-import os.path
import stat
import sys
-import UserList
+try:
+ from collections import UserList
+except ImportError:
+ # no 'collections' module or no UserList in collections
+ exec('from UserList import UserList')
from TestCmd import *
from TestCmd import __all__
@@ -171,8 +174,7 @@ else:
dll_suffix = '.so'
def is_List(e):
- return isinstance(e, list) \
- or isinstance(e, UserList.UserList)
+ return isinstance(e, (list,UserList))
def is_writable(f):
mode = os.stat(f)[stat.ST_MODE]