Skip to content

Commit

Permalink
Avoid py f-strings to support py < 3.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Jan 9, 2024
1 parent 6418945 commit bf44f19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions test/BoostBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def write(self, file, content, wait=True):
with open(nfile, "wb") as f:
f.write(content)
except Exception as e:
annotation("failure", f"Could not create file '{nfile}': {e}")
annotation("failure","Could not create file '{}': {}".format(nfile, e))
annotate_stack_trace(level=3)
self.fail_test(1)
self.__ensure_newer_than_last_build(nfile)
Expand Down Expand Up @@ -580,11 +580,11 @@ def do_diff(self, what, actual, expected, matcher, match_filter):
if match:
return
diff = "".join(ndiff(expected_lines, actual_lines))
annotation(f"Expected {what}", expected)
annotation(f"Actual {what}", actual)
annotation("Expected {}".format(what), expected)
annotation("Actual {}".format(what), actual)
if what.lower() == "stdout":
annotation("STDERR", self.stderr())
annotation(f"Difference in {what}{filtered}", diff)
annotation("Difference in {}{}".format(what, filtered), diff)
self.fail_test(True, dump_stdio=False)

def glob_file(self, name):
Expand Down Expand Up @@ -1059,7 +1059,7 @@ def __makedirs(self, path, wait):
else:
os.makedirs(path, exist_ok=True)
except Exception as e:
annotation("failure", f"Could not create path '{path}': {e}")
annotation("failure", "Could not create path '{}': {}".format(path, e))
annotate_stack_trace(level=3)
self.fail_test(1)

Expand Down
8 changes: 4 additions & 4 deletions test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def handler(sig, frame):
if not xml:
s = "%%-%ds :" % max_test_name_len % test
if isatty:
s = f"\r{s}"
s = "\r{}".format(s)
print(s, end='')

passed = 0
Expand Down Expand Up @@ -148,15 +148,15 @@ def handler(sig, frame):

if not xml:
if passed:
print(f"PASSED {ts * 1000:>5.0f}ms")
print("PASSED {:>5.0f}ms".format(ts*1000))
else:
print(f"FAILED {ts * 1000:>5.0f}ms")
print("FAILED {:>5.0f}ms".format(ts*1000))
BoostBuild.flush_annotations()

if isatty:
msg = ", ".join(futures[future] for future in pending if future.running())
if msg:
msg = f"[{len(futures) - len(pending)}/{len(futures)}] {msg}"
msg = "[{}/{}] {}".format(len(futures) - len(pending),len(futures),msg)
max_len = max_test_name_len + len(" :PASSED 12345ms")
if len(msg) > max_len:
msg = msg[:max_len - 3] + "..."
Expand Down
2 changes: 1 addition & 1 deletion test/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _pprint_filelist(names):
s = repr(names)
if len(s) < 70:
return s
return "".join(f"\n - {name}" for name in names)
return "".join("\n - {}".format(name) for name in names)

def pprint(self, file=sys.stdout):
file.write("Added files : %s\n" % self._pprint_filelist(self.added_files))
Expand Down

0 comments on commit bf44f19

Please sign in to comment.