summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2020-12-05 16:33:39 (GMT)
committerMats Wichmann <mats@linux.com>2020-12-05 16:33:39 (GMT)
commit1250170e9d12f8b894a7bc6a27a63fddaca702b7 (patch)
treebaf747e41f663ec79c661c44d5e6874c972279bf
parent2f6a933a155121093e5427fab7e82cefe0cbe6ab (diff)
downloadSCons-1250170e9d12f8b894a7bc6a27a63fddaca702b7.zip
SCons-1250170e9d12f8b894a7bc6a27a63fddaca702b7.tar.gz
SCons-1250170e9d12f8b894a7bc6a27a63fddaca702b7.tar.bz2
[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>
-rw-r--r--test/SConsignFile/default.py24
-rw-r--r--test/SConsignFile/explicit-dbm-module.py3
-rw-r--r--test/SConsignFile/explicit-file.py26
-rw-r--r--test/SConsignFile/make-directory.py17
-rw-r--r--test/SConsignFile/use-dbhash.py18
-rw-r--r--test/SConsignFile/use-dbm.py40
-rw-r--r--test/SConsignFile/use-dumbdbm.py25
-rw-r--r--test/SConsignFile/use-gdbm.py23
8 files changed, 85 insertions, 91 deletions
diff --git a/test/SConsignFile/default.py b/test/SConsignFile/default.py
index ed1ed56..281632d 100644
--- a/test/SConsignFile/default.py
+++ b/test/SConsignFile/default.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,12 +22,9 @@
# 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 the default behavior of SConsignFile(), called with no arguments.
+Verify the behavior of SConsignFile() called with a subst-able path.
"""
import TestSCons
@@ -46,12 +45,13 @@ sys.exit(0)
#
test.write('SConstruct', """
SConsignFile()
-B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES')
-env = Environment(BUILDERS = { 'B' : B })
-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')
+DefaultEnvironment(tools=[])
+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")
@@ -70,7 +70,7 @@ test.must_match('f2.out', "f2.in\n")
test.must_match(['subdir', 'f3.out'], "subdir/f3.in\n")
test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n")
-test.up_to_date(arguments = '.')
+test.up_to_date(arguments='.')
test.must_exist(test.workpath('.sconsign.dblite'))
test.must_not_exist(test.workpath('.sconsign'))
diff --git a/test/SConsignFile/explicit-dbm-module.py b/test/SConsignFile/explicit-dbm-module.py
index 09b75ae..2461d5c 100644
--- a/test/SConsignFile/explicit-dbm-module.py
+++ b/test/SConsignFile/explicit-dbm-module.py
@@ -3,6 +3,7 @@
# 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
# "Software"), to deal in the Software without restriction, including
@@ -47,8 +48,8 @@ sys.exit(0)
test.write('SConstruct', """
import %(use_db)s
SConsignFile(dbm_module=%(use_db)s)
-B = Builder(action=r'%(_python_)s build.py $TARGETS $SOURCES')
DefaultEnvironment(tools=[])
+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')
diff --git a/test/SConsignFile/explicit-file.py b/test/SConsignFile/explicit-file.py
index afb2dbd..d579858 100644
--- a/test/SConsignFile/explicit-file.py
+++ b/test/SConsignFile/explicit-file.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,12 +22,9 @@
# 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 the default behavior of SConsignFile(), called with no arguments.
+Verify the default behavior of env.SConsignFile(), called with no arguments.
"""
import TestSCons
@@ -44,14 +43,15 @@ with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp:
#
test.write('SConstruct', """
-e = Environment(XXX = 'scons')
+DefaultEnvironment(tools=[])
+e = Environment(XXX='scons', tools=[])
e.SConsignFile('my_${XXX}ign')
-B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES')
-env = Environment(BUILDERS = { 'B' : B })
-env.B(target = 'f5.out', source = 'f5.in')
-env.B(target = 'f6.out', source = 'f6.in')
-env.B(target = 'subdir/f7.out', source = 'subdir/f7.in')
-env.B(target = 'subdir/f8.out', source = 'subdir/f8.in')
+B = Builder(action=r'%(_python_)s build.py $TARGETS $SOURCES')
+env = Environment(BUILDERS={'B': B}, tools=[])
+env.B(target='f5.out', source='f5.in')
+env.B(target='f6.out', source='f6.in')
+env.B(target='subdir/f7.out', source='subdir/f7.in')
+env.B(target='subdir/f8.out', source='subdir/f8.in')
""" % locals())
test.write('f5.in', "f5.in\n")
@@ -70,7 +70,7 @@ test.must_match('f6.out', "f6.in\n")
test.must_match(['subdir', 'f7.out'], "subdir/f7.in\n")
test.must_match(['subdir', 'f8.out'], "subdir/f8.in\n")
-test.up_to_date(arguments = '.')
+test.up_to_date(arguments='.')
test.must_exist(test.workpath('my_sconsign.dblite'))
test.must_not_exist(test.workpath('.sconsign'))
diff --git a/test/SConsignFile/make-directory.py b/test/SConsignFile/make-directory.py
index 50bab79..264ee26 100644
--- a/test/SConsignFile/make-directory.py
+++ b/test/SConsignFile/make-directory.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 the ability to make a SConsignFile() in a non-existent
@@ -40,15 +39,17 @@ bar_foo_txt = os.path.join('bar', 'foo.txt')
test.write('SConstruct', """
import SCons.dblite
-env = Environment()
+DefaultEnvironment(tools=[])
+env = Environment(tools=[])
env.SConsignFile("sub/dir/sconsign", SCons.dblite)
env.Install('bar', 'foo.txt')
""")
test.write('foo.txt', "Foo\n")
-
-expect = test.wrap_stdout(read_str = 'Mkdir("%s")\n' % sub_dir,
- build_str = 'Install file: "foo.txt" as "%s"\n' % bar_foo_txt)
+expect = test.wrap_stdout(
+ read_str='Mkdir("%s")\n' % sub_dir,
+ build_str='Install file: "foo.txt" as "%s"\n' % bar_foo_txt,
+)
test.run(options='-n', stdout=expect)
diff --git a/test/SConsignFile/use-dbhash.py b/test/SConsignFile/use-dbhash.py
index e57e244..0e8e40c 100644
--- a/test/SConsignFile/use-dbhash.py
+++ b/test/SConsignFile/use-dbhash.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 dbhash.
@@ -36,8 +35,9 @@ test = TestSCons.TestSCons()
try:
import dbm.bsd
+ use_dbm = 'dbm.bsd'
except ImportError:
- test.skip_test('No dbhash in this version of Python; skipping test.\n')
+ test.skip_test('No dbm.bsd in this version of Python; skipping test.\n')
test.subdir('subdir')
@@ -50,11 +50,11 @@ sys.exit(0)
#
test.write('SConstruct', """
-import sys
-import dbhash
-SConsignFile('.sconsign', dbhash)
+import %(use_dbm
+SConsignFile('.sconsign', %(use_dbm)s)
+DefaultEnvironment(tools=[])
B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES')
-env = Environment(BUILDERS = { 'B' : B })
+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')
diff --git a/test/SConsignFile/use-dbm.py b/test/SConsignFile/use-dbm.py
index 5100916..a1ef1b2 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'))
diff --git a/test/SConsignFile/use-dumbdbm.py b/test/SConsignFile/use-dumbdbm.py
index 22b0bff..875f3fc 100644
--- a/test/SConsignFile/use-dumbdbm.py
+++ b/test/SConsignFile/use-dumbdbm.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 dumbdbm.
@@ -36,7 +35,7 @@ test = TestSCons.TestSCons()
try:
import dbm.dumb
- use_dbm='dbm.dumb'
+ use_dbm = 'dbm.dumb'
except ImportError:
test.skip_test('No dbm.dumb in this version of Python; skipping test.\n')
@@ -51,15 +50,15 @@ sys.exit(0)
#
test.write('SConstruct', """
-import sys
import %(use_dbm)s
SConsignFile('.sconsign', %(use_dbm)s)
-B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES')
-env = Environment(BUILDERS = { 'B' : B })
-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')
+DefaultEnvironment(tools=[])
+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")
@@ -83,7 +82,7 @@ test.must_match('f2.out', "f2.in\n")
test.must_match(['subdir', 'f3.out'], "subdir/f3.in\n")
test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n")
-test.up_to_date(arguments = '.')
+test.up_to_date(arguments='.')
test.must_exist(test.workpath('.sconsign.dat'))
test.must_exist(test.workpath('.sconsign.dir'))
diff --git a/test/SConsignFile/use-gdbm.py b/test/SConsignFile/use-gdbm.py
index 461a482..c1f0c4d 100644
--- a/test/SConsignFile/use-gdbm.py
+++ b/test/SConsignFile/use-gdbm.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 gdbm.
@@ -51,15 +50,15 @@ sys.exit(0)
#
test.write('SConstruct', """
-import sys
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')
-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')
+DefaultEnvironment(tools=[])
+B = Builder(action='%(_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")
@@ -79,7 +78,7 @@ test.must_match('f2.out', "f2.in\n")
test.must_match(['subdir', 'f3.out'], "subdir/f3.in\n")
test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n")
-test.up_to_date(arguments = '.')
+test.up_to_date(arguments='.')
test.must_exist(test.workpath('.sconsign'))
test.must_not_exist(test.workpath('.sconsign.dblite'))