Skip to content

Commit 9fc1857

Browse files
committed
Some minor test tweaking
Don't """code block""" % locals() if there's not actually a substitution in the code block. While there, fix any old-style file headers, and add a DefaultEnvironment call if not present. Signed-off-by: Mats Wichmann <mats@linux.com>
1 parent b51ea22 commit 9fc1857

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+196
-172
lines changed

bin/scons-time.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ class SConsTimer:
278278
name = 'scons-time'
279279
name_spaces = ' ' * len(name)
280280

281+
@staticmethod
281282
def makedict(**kw):
282283
return kw
283284

test/CacheDir/value_dependencies/SConstruct

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import SCons.Node
77
CacheDir('cache')
88

99
def b(target, source, env):
10-
with open(target[0].abspath, 'w') as f:
11-
pass
10+
with open(target[0].abspath, 'w') as f:
11+
pass
1212

1313
def scan(node, env, path):
1414
"""Have the node depend on a directory, which depends on a Value node."""

test/Configure/custom-tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
""")
5656

5757
test.write('SConstruct', """\
58-
DefaultEnvironment(tools=[])
58+
DefaultEnvironment(tools=[])
5959
def CheckCustom(test):
6060
test.Message( 'Executing MyTest ... ' )
6161
retCompileOK = test.TryCompile( '%(compileOK)s', '.c' )
@@ -164,7 +164,7 @@ def CheckEmptyDict(test):
164164
conf.CheckDict()
165165
conf.CheckEmptyDict()
166166
env = conf.Finish()
167-
""" % locals())
167+
""")
168168

169169
test.run()
170170

test/Errors/preparation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python
22
#
3-
# __COPYRIGHT__
3+
# MIT License
4+
#
5+
# Copyright The SCons Foundation
46
#
57
# Permission is hereby granted, free of charge, to any person obtaining
68
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
2022
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2123
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2224
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23-
#
24-
25-
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
2625

2726
"""
2827
A currently disabled test that used to verify that we print a useful
@@ -49,14 +48,15 @@
4948
test.subdir('install', 'work')
5049

5150
test.write(['work', 'SConstruct'], """\
51+
_ = DefaultEnvironment(tools=[])
5252
file_out = Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE'))
5353
Alias("install", file_out)
5454
5555
# Make a directory where we expect the File() to be. This causes an
5656
# IOError or OSError when we try to open it to read its signature.
5757
import os
5858
os.mkdir('file.in')
59-
""" % locals())
59+
""")
6060

6161
if sys.platform == 'win32':
6262
error_message = "Permission denied"

test/GetBuildFailures/option-k.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python
22
#
3-
# __COPYRIGHT__
3+
# MIT License
4+
#
5+
# Copyright The SCons Foundation
46
#
57
# Permission is hereby granted, free of charge, to any person obtaining
68
# a copy of this software and associated documentation files (the
@@ -20,14 +22,11 @@
2022
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2123
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2224
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23-
#
2425

2526
"""
2627
Verify that a failed build action with -k works as expected.
2728
"""
2829

29-
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
30-
3130
import TestSCons
3231

3332
_python_ = TestSCons._python_
@@ -85,7 +84,7 @@ def print_build_failures():
8584
scons: done building targets (errors occurred during build).
8685
f4 failed: Error 1
8786
f5 failed: Error 1
88-
""" % locals()
87+
"""
8988

9089
expect_stderr = """\
9190
scons: *** [f4] Error 1
@@ -99,7 +98,7 @@ def print_build_failures():
9998
test.must_match(test.workpath('f3'), 'f3.in\n')
10099
test.must_not_exist(test.workpath('f4'))
101100
test.must_not_exist(test.workpath('f5'))
102-
test.must_match(test.workpath('f6'), 'f6.in\n')
101+
test.must_match(test.workpath('f6'), 'f6.in\n')
103102

104103

105104
test.pass_test()

test/Java/JARCHDIR.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
${TARGET} or ${SOURCE} work.
3333
"""
3434

35-
3635
import TestSCons
3736

3837
test = TestSCons.TestSCons()
@@ -60,7 +59,7 @@
6059
source_env.Jar('out/s.jar', 'in/s.class')
6160
6261
Default(bin, jar, inner)
63-
""" % locals())
62+
""")
6463

6564
test.subdir('in')
6665

test/Java/JARFLAGS.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
env['JARFLAGS'] = 'cvf'
4040
class_files = env.Java(target='classes', source='src')
4141
env.Jar(target='test.jar', source=class_files)
42-
""" % locals())
42+
""")
4343

4444
test.write(['src', 'Example1.java'], """\
4545
package src;
@@ -60,7 +60,7 @@
6060
jar cvf test.jar -C classes src.Example1\\.class
6161
.*
6262
adding: src.Example1\\.class.*
63-
""" % locals())
63+
""")
6464

6565

6666
test.run(arguments = '.',

test/Java/JAVACFLAGS.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
DefaultEnvironment(tools=[])
3838
env = Environment(tools=['javac'], JAVACFLAGS='-O')
3939
env.Java(target='classes', source='src')
40-
""" % locals())
40+
""")
4141

4242
test.write(['src', 'Example1.java'], """\
4343
package src;

test/Java/JAVACLASSPATH.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
j1 = env.Java(target='class1', source='com.1/Example1.java')
6060
j2 = env.Java(target='class2', source='com.2/Example2.java')
6161
env.JavaH(target='outdir', source=[j1, j2], JAVACLASSPATH='class2')
62-
""" % locals())
62+
""")
6363

6464
test.subdir('com.1', 'com.2')
6565

test/Java/JAVAH.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
# Skip this test as SCons doesn't (currently) predict the generated
4141
# inner/anonymous class generated .class files generated by gcj
42-
# and so will always fail
42+
# and so will always fail
4343
if test.javac_is_gcj:
4444
test.skip_test('Test not valid for gcj (gnu java); skipping test(s).\n')
4545

@@ -242,8 +242,7 @@ class Private {
242242

243243
test.must_match(
244244
'wrapper.out',
245-
"wrapper_with_args.py javah -d outdir2 -classpath class2 com.sub.bar.Example4 com.other.Example5 com.sub.bar.Example6\n"
246-
% locals(),
245+
"wrapper_with_args.py javah -d outdir2 -classpath class2 com.sub.bar.Example4 com.other.Example5 com.sub.bar.Example6\n",
247246
mode='r',
248247
)
249248

0 commit comments

Comments
 (0)