Skip to content

Commit 9bece9f

Browse files
authored
Merge pull request SCons#4568 from mwichmann/maint/more-test-tweaks
Some minor test tweaking
2 parents b51ea22 + 93a7d1e commit 9bece9f

Some content is hidden

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

43 files changed

+198
-175
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
178178
- Regularized header (copyright, licens) at top of documentation files
179179
using SPDX.
180180
- Updated introductory section of manual page.
181+
- Minor cleanups in tests - drop unused "% locals()" stanzas.
181182

182183

183184
RELEASE 4.7.0 - Sun, 17 Mar 2024 17:22:20 -0700

bin/scons-time.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ def redirect_to_file(command, log):
260260
def tee_to_file(command, log):
261261
return '%s 2>&1 | tee %s' % (command, log)
262262

263+
def makedict(**kw):
264+
return kw
263265

264266
class SConsTimer:
265267
"""
@@ -278,9 +280,6 @@ class SConsTimer:
278280
name = 'scons-time'
279281
name_spaces = ' ' * len(name)
280282

281-
def makedict(**kw):
282-
return kw
283-
284283
default_settings = makedict(
285284
chdir=None,
286285
config_file=None,

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

0 commit comments

Comments
 (0)