Skip to content

Commit 3d5b4d8

Browse files
committed
[fuchsia-test-runner] Reformat fuchsia-test-runner.py
Applied formatting suggestions from isort and black via pylsp.
1 parent 54aa9e8 commit 3d5b4d8

File tree

1 file changed

+15
-37
lines changed

1 file changed

+15
-37
lines changed

src/ci/docker/scripts/fuchsia-test-runner.py

+15-37
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
"""
99

1010
import argparse
11-
from concurrent.futures import ThreadPoolExecutor
12-
from dataclasses import dataclass
1311
import glob
1412
import io
1513
import json
@@ -20,6 +18,8 @@
2018
import shutil
2119
import subprocess
2220
import sys
21+
from concurrent.futures import ThreadPoolExecutor
22+
from dataclasses import dataclass
2323
from pathlib import Path
2424
from typing import ClassVar, List, Optional
2525

@@ -42,12 +42,8 @@ def exhaust_pipe(handler, pipe):
4242
for line in pipe:
4343
handler(line.rstrip())
4444

45-
executor_out = executor.submit(
46-
exhaust_pipe, stdout_handler, process.stdout
47-
)
48-
executor_err = executor.submit(
49-
exhaust_pipe, stderr_handler, process.stderr
50-
)
45+
executor_out = executor.submit(exhaust_pipe, stdout_handler, process.stdout)
46+
executor_err = executor.submit(exhaust_pipe, stderr_handler, process.stderr)
5147
executor_out.result()
5248
executor_err.result()
5349
retcode = process.poll()
@@ -203,9 +199,7 @@ def build_id(self, binary):
203199
raise Exception(f"Unreadable build-id for binary {binary}")
204200
data = json.loads(process.stdout)
205201
if len(data) != 1:
206-
raise Exception(
207-
f"Unreadable output from llvm-readelf for binary {binary}"
208-
)
202+
raise Exception(f"Unreadable output from llvm-readelf for binary {binary}")
209203
notes = data[0]["Notes"]
210204
for note in notes:
211205
note_section = note["NoteSection"]
@@ -265,9 +259,7 @@ def write_to_file(self):
265259
def setup_logging(self, log_to_file=False):
266260
fs = logging.Formatter("%(asctime)s %(levelname)s:%(name)s:%(message)s")
267261
if log_to_file:
268-
logfile_handler = logging.FileHandler(
269-
self.tmp_dir().joinpath("log")
270-
)
262+
logfile_handler = logging.FileHandler(self.tmp_dir().joinpath("log"))
271263
logfile_handler.setLevel(logging.DEBUG)
272264
logfile_handler.setFormatter(fs)
273265
logging.getLogger().addHandler(logfile_handler)
@@ -447,9 +439,7 @@ def start(self):
447439
# Initialize temp directory
448440
os.makedirs(self.tmp_dir(), exist_ok=True)
449441
if len(os.listdir(self.tmp_dir())) != 0:
450-
raise Exception(
451-
f"Temp directory is not clean (in {self.tmp_dir()})"
452-
)
442+
raise Exception(f"Temp directory is not clean (in {self.tmp_dir()})")
453443
self.setup_logging(log_to_file=True)
454444
os.mkdir(self.output_dir)
455445

@@ -486,9 +476,7 @@ def start(self):
486476
shutil.rmtree(self.local_pb_path, ignore_errors=True)
487477

488478
# Look up the product bundle transfer manifest.
489-
self.env_logger.info(
490-
"Looking up the product bundle transfer manifest..."
491-
)
479+
self.env_logger.info("Looking up the product bundle transfer manifest...")
492480
product_name = "minimal." + self.triple_to_arch(self.target)
493481
sdk_version = self.read_sdk_version()
494482

@@ -510,9 +498,7 @@ def start(self):
510498
)
511499

512500
try:
513-
transfer_manifest_url = json.loads(output)[
514-
"transfer_manifest_url"
515-
]
501+
transfer_manifest_url = json.loads(output)["transfer_manifest_url"]
516502
except Exception as e:
517503
print(e)
518504
raise Exception("Unable to parse transfer manifest") from e
@@ -762,9 +748,7 @@ def run(self, args):
762748
# Use /tmp as the test temporary directory
763749
env_vars += '\n "RUST_TEST_TMPDIR=/tmp",'
764750

765-
cml.write(
766-
self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name)
767-
)
751+
cml.write(self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name))
768752

769753
runner_logger.info("Compiling CML...")
770754

@@ -915,17 +899,13 @@ def run(self, args):
915899

916900
if stdout_path is not None:
917901
if not os.path.exists(stdout_path):
918-
runner_logger.error(
919-
f"stdout file {stdout_path} does not exist."
920-
)
902+
runner_logger.error(f"stdout file {stdout_path} does not exist.")
921903
else:
922904
with open(stdout_path, encoding="utf-8", errors="ignore") as f:
923905
sys.stdout.write(f.read())
924906
if stderr_path is not None:
925907
if not os.path.exists(stderr_path):
926-
runner_logger.error(
927-
f"stderr file {stderr_path} does not exist."
928-
)
908+
runner_logger.error(f"stderr file {stderr_path} does not exist.")
929909
else:
930910
with open(stderr_path, encoding="utf-8", errors="ignore") as f:
931911
sys.stderr.write(f.read())
@@ -1030,7 +1010,7 @@ def debug(self, args):
10301010
f"--symbol-path={self.rust_dir}/lib/rustlib/{self.target}/lib",
10311011
]
10321012

1033-
# Add rust source if it's available
1013+
# Add rust source if it's available
10341014
rust_src_map = None
10351015
if args.rust_src is not None:
10361016
# This matches the remapped prefix used by compiletest. There's no
@@ -1203,7 +1183,7 @@ def print_help(args):
12031183
start_parser.add_argument(
12041184
"--use-local-product-bundle-if-exists",
12051185
help="if the product bundle already exists in the local path, use "
1206-
"it instead of downloading it again",
1186+
"it instead of downloading it again",
12071187
action="store_true",
12081188
)
12091189
start_parser.set_defaults(func=start)
@@ -1239,9 +1219,7 @@ def print_help(args):
12391219
)
12401220
cleanup_parser.set_defaults(func=cleanup)
12411221

1242-
syslog_parser = subparsers.add_parser(
1243-
"syslog", help="prints the device syslog"
1244-
)
1222+
syslog_parser = subparsers.add_parser("syslog", help="prints the device syslog")
12451223
syslog_parser.set_defaults(func=syslog)
12461224

12471225
debug_parser = subparsers.add_parser(

0 commit comments

Comments
 (0)