Skip to content

Commit

Permalink
Replace .format() with f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Mar 18, 2024
1 parent a69025b commit c430452
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions python/lsst/sconsUtils/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ def finish(defaultTargets=DEFAULT_TARGETS, subDirList=None, ignoreRegex=None):
checkTestStatus_command = state.env.Command(
"checkTestStatus",
[],
"""
@ if [ -d {0} ]; then \
nfail=`find {0} -name "*.failed" | wc -l | sed -e 's/ //g'`; \
f"""
@ if [ -d {testsDir} ]; then \
nfail=`find {testsDir} -name "*.failed" | wc -l | sed -e 's/ //g'`; \
if [ $$nfail -gt 0 ]; then \
echo "Failed test output:" >&2; \
for f in `find {0} -name "*.failed"`; do \
for f in `find {testsDir} -name "*.failed"`; do \
case "$$f" in \
*.xml.failed) \
echo "Global pytest output is in $$f" >&2; \
Expand All @@ -263,13 +263,11 @@ def finish(defaultTargets=DEFAULT_TARGETS, subDirList=None, ignoreRegex=None):
esac; \
done; \
echo "The following tests failed:" >&2;\
find {0} -name "*.failed" >&2; \
find {testsDir} -name "*.failed" >&2; \
echo "$$nfail tests failed" >&2; exit 1; \
fi; \
fi; \
""".format(
testsDir
),
""",
)

state.env.Depends(checkTestStatus_command, BUILD_TARGETS) # this is why the check runs last
Expand Down Expand Up @@ -372,8 +370,8 @@ def rewrite_shebang(target, source, env):
else:
if not match:
state.log.warn(
"Could not rewrite shebang of {}. Please check"
" file or move it to bin directory.".format(str(src))
f"Could not rewrite shebang of {src}. Please check"
" file or move it to bin directory."
)
outfd.write(first_line)
for line in srcfd.readlines():
Expand Down Expand Up @@ -677,8 +675,7 @@ def s(ll):
for node in pySingles:
if str(node).startswith("test_"):
state.log.warn(
"Warning: {} should be run independently but"
" can be automatically discovered".format(node)
f"Warning: {node} should be run independently but can be automatically discovered"
)

# Ensure that python tests listed in pySingles are not included in
Expand Down

0 comments on commit c430452

Please sign in to comment.