Skip to content

Commit 87d9ee1

Browse files
committed
Replace .format() with f-strings
1 parent e8ba3c3 commit 87d9ee1

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

python/lsst/sconsUtils/scripts.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@ def finish(defaultTargets=DEFAULT_TARGETS, subDirList=None, ignoreRegex=None):
247247
checkTestStatus_command = state.env.Command(
248248
"checkTestStatus",
249249
[],
250-
"""
251-
@ if [ -d {0} ]; then \
252-
nfail=`find {0} -name "*.failed" | wc -l | sed -e 's/ //g'`; \
250+
f"""
251+
@ if [ -d {testsDir} ]; then \
252+
nfail=`find {testsDir} -name "*.failed" | wc -l | sed -e 's/ //g'`; \
253253
if [ $$nfail -gt 0 ]; then \
254254
echo "Failed test output:" >&2; \
255-
for f in `find {0} -name "*.failed"`; do \
255+
for f in `find {testsDir} -name "*.failed"`; do \
256256
case "$$f" in \
257257
*.xml.failed) \
258258
echo "Global pytest output is in $$f" >&2; \
@@ -263,13 +263,11 @@ def finish(defaultTargets=DEFAULT_TARGETS, subDirList=None, ignoreRegex=None):
263263
esac; \
264264
done; \
265265
echo "The following tests failed:" >&2;\
266-
find {0} -name "*.failed" >&2; \
266+
find {testsDir} -name "*.failed" >&2; \
267267
echo "$$nfail tests failed" >&2; exit 1; \
268268
fi; \
269269
fi; \
270-
""".format(
271-
testsDir
272-
),
270+
""",
273271
)
274272

275273
state.env.Depends(checkTestStatus_command, BUILD_TARGETS) # this is why the check runs last
@@ -372,8 +370,8 @@ def rewrite_shebang(target, source, env):
372370
else:
373371
if not match:
374372
state.log.warn(
375-
"Could not rewrite shebang of {}. Please check"
376-
" file or move it to bin directory.".format(str(src))
373+
f"Could not rewrite shebang of {src}. Please check"
374+
" file or move it to bin directory."
377375
)
378376
outfd.write(first_line)
379377
for line in srcfd.readlines():
@@ -677,8 +675,7 @@ def s(ll):
677675
for node in pySingles:
678676
if str(node).startswith("test_"):
679677
state.log.warn(
680-
"Warning: {} should be run independently but"
681-
" can be automatically discovered".format(node)
678+
f"Warning: {node} should be run independently but can be automatically discovered"
682679
)
683680

684681
# Ensure that python tests listed in pySingles are not included in

0 commit comments

Comments
 (0)