summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/EnvironmentTests.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-03-25 17:45:47 (GMT)
committerSteven Knight <knight@baldmt.com>2010-03-25 17:45:47 (GMT)
commit00a3188193ba1feef927cf18e7f5fc20ad71b848 (patch)
treef8c812f0a53a29928002a5a4dd8677b68f876c36 /src/engine/SCons/EnvironmentTests.py
parentae2eceea0c23218728f304296e6e6e328550738a (diff)
downloadSCons-00a3188193ba1feef927cf18e7f5fc20ad71b848.zip
SCons-00a3188193ba1feef927cf18e7f5fc20ad71b848.tar.gz
SCons-00a3188193ba1feef927cf18e7f5fc20ad71b848.tar.bz2
Issue 2327: provide a compat sorted() function for pre-2.4 Python versions.
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
-rw-r--r--src/engine/SCons/EnvironmentTests.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 7d3d33e..b692e96 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -23,6 +23,8 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import copy
import os
import StringIO
@@ -40,9 +42,7 @@ def diff_env(env1, env2):
d = {}
for k in env1._dict.keys() + env2._dict.keys():
d[k] = None
- keys = d.keys()
- keys.sort()
- for k in keys:
+ for k in sorted(d.keys()):
if k in env1:
if k in env2:
if env1[k] != env2[k]:
@@ -62,9 +62,7 @@ def diff_dict(d1, d2):
d = {}
for k in d1.keys() + d2.keys():
d[k] = None
- keys = d.keys()
- keys.sort()
- for k in keys:
+ for k in sorted(d.keys()):
if k in d1:
if k in d2:
if d1[k] != d2[k]:
@@ -3667,14 +3665,11 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture):
def test_items(self):
"""Test the OverrideEnvironment items() method"""
env, env2, env3 = self.envs
- items = env.items()
- items.sort()
+ items = sorted(env.items())
assert items == [('XXX', 'x'), ('YYY', 'y')], items
- items = env2.items()
- items.sort()
+ items = sorted(env2.items())
assert items == [('XXX', 'x2'), ('YYY', 'y')], items
- items = env3.items()
- items.sort()
+ items = sorted(env3.items())
assert items == [('XXX', 'x3'), ('YYY', 'y3'), ('ZZZ', 'z3')], items
def test_gvars(self):