summaryrefslogtreecommitdiff
path: root/test/SConsignFile/use-dbm.py
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2020-12-05 09:33:39 -0700
committerMats Wichmann <mats@linux.com>2020-12-05 09:33:39 -0700
commit1250170e9d12f8b894a7bc6a27a63fddaca702b7 (patch)
treebaf747e41f663ec79c661c44d5e6874c972279bf /test/SConsignFile/use-dbm.py
parent2f6a933a155121093e5427fab7e82cefe0cbe6ab (diff)
downloadscons-git-1250170e9d12f8b894a7bc6a27a63fddaca702b7.tar.gz
[PR #3836] while we're at it, update SConsignFile tests
Formatting, copyright header, make sure to null out tools to speed up Windeows. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/SConsignFile/use-dbm.py')
-rw-r--r--test/SConsignFile/use-dbm.py40
1 files changed, 17 insertions, 23 deletions
diff --git a/test/SConsignFile/use-dbm.py b/test/SConsignFile/use-dbm.py
index 510091626..a1ef1b269 100644
--- a/test/SConsignFile/use-dbm.py
+++ b/test/SConsignFile/use-dbm.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify SConsignFile() when used with dbm.
@@ -37,15 +36,9 @@ test = TestSCons.TestSCons()
try:
import dbm.ndbm
-
- use_db = 'dbm.ndbm'
+ use_dbm = 'dbm.ndbm'
except ImportError:
- try:
- import dbm
-
- use_db = 'dbm'
- except ImportError:
- test.skip_test('No dbm.ndbm in this version of Python; skipping test.\n')
+ test.skip_test('No dbm.ndbm in this version of Python; skipping test.\n')
test.subdir('subdir')
@@ -58,16 +51,15 @@ sys.exit(0)
#
test.write('SConstruct', """
-import sys
-import %(use_db)s
-SConsignFile('.sconsign', %(use_db)s)
-B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES')
+import %(use_dbm)s
+SConsignFile('.sconsign', %(use_dbm)s)
DefaultEnvironment(tools=[])
-env = Environment(BUILDERS = { 'B' : B }, tools=[])
-env.B(target = 'f1.out', source = 'f1.in')
-env.B(target = 'f2.out', source = 'f2.in')
-env.B(target = 'subdir/f3.out', source = 'subdir/f3.in')
-env.B(target = 'subdir/f4.out', source = 'subdir/f4.in')
+B = Builder(action=r'%(_python_)s build.py $TARGETS $SOURCES')
+env = Environment(BUILDERS={'B': B}, tools=[])
+env.B(target='f1.out', source='f1.in')
+env.B(target='f2.out', source='f2.in')
+env.B(target='subdir/f3.out', source='subdir/f3.in')
+env.B(target='subdir/f4.out', source='subdir/f4.in')
""" % locals())
test.write('f1.in', "f1.in\n")
@@ -80,8 +72,10 @@ test.run()
# We don't check for explicit .db or other file, because base "dbm"
# can use different file extensions on different implementations.
-test.fail_test(os.path.exists('.sconsign') and 'dbm' not in dbm.whichdb('.sconsign'),
- message=".sconsign existed and wasn't any type of dbm file")
+test.fail_test(
+ os.path.exists('.sconsign') and 'dbm' not in dbm.whichdb('.sconsign'),
+ message=".sconsign existed and wasn't any type of dbm file",
+)
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'))