summaryrefslogtreecommitdiffstats
path: root/test/SConsignFile
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-05-29 13:49:22 (GMT)
committerMats Wichmann <mats@linux.com>2019-05-30 12:48:08 (GMT)
commitc2cf24a5be13852cc65c4a9071f52f2715bc409c (patch)
tree4bf14f6159e40ec89b5517268878294475612f65 /test/SConsignFile
parent886af259720ca20e1473ebe5cc5a919422f3b85d (diff)
downloadSCons-c2cf24a5be13852cc65c4a9071f52f2715bc409c.zip
SCons-c2cf24a5be13852cc65c4a9071f52f2715bc409c.tar.gz
SCons-c2cf24a5be13852cc65c4a9071f52f2715bc409c.tar.bz2
Tweak a few tests
"for i in range(len(foo))" idiom changed to iterate directly over lists instead of indexing them. zip() generates the iterator in the case with two lists. reversed() used for the Windows drive-letter test. gdbm is not gone, just renamed. change test to find under either name. Use a context manager for closing StringIO objects opened for capturing standard I/O streams. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/SConsignFile')
-rw-r--r--test/SConsignFile/use-gdbm.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/SConsignFile/use-gdbm.py b/test/SConsignFile/use-gdbm.py
index 8f863fb..12a2e8b 100644
--- a/test/SConsignFile/use-gdbm.py
+++ b/test/SConsignFile/use-gdbm.py
@@ -36,8 +36,13 @@ test = TestSCons.TestSCons()
try:
import gdbm
+ use_dbm = "gdbm"
except ImportError:
- test.skip_test('No gdbm in this version of Python; skipping test.\n')
+ try:
+ import dbm.gnu
+ use_dbm = "dbm.gnu"
+ except ImportError:
+ test.skip_test('No GNU dbm in this version of Python; skipping test.\n')
test.subdir('subdir')
@@ -51,8 +56,8 @@ sys.exit(0)
#
test.write('SConstruct', """
import sys
-import gdbm
-SConsignFile('.sconsign', gdbm)
+import %(use_dbm)s
+SConsignFile('.sconsign', %(use_dbm)s)
B = Builder(action = '%(_python_)s build.py $TARGETS $SOURCES')
env = Environment(BUILDERS = { 'B' : B })
env.B(target = 'f1.out', source = 'f1.in')
@@ -72,7 +77,7 @@ test.must_exist(test.workpath('.sconsign'))
test.must_not_exist(test.workpath('.sconsign.dblite'))
test.must_not_exist(test.workpath('subdir', '.sconsign'))
test.must_not_exist(test.workpath('subdir', '.sconsign.dblite'))
-
+
test.must_match('f1.out', "f1.in\n")
test.must_match('f2.out', "f2.in\n")
test.must_match(['subdir', 'f3.out'], "subdir/f3.in\n")