Skip to content

Commit d1e1092

Browse files
committed
Python formatting
1 parent 6bb5402 commit d1e1092

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

cmake/settings/ini-to-stdio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def main():
9090
except KeyError as key_error:
9191
print(
9292
f"[WARNING] Failed to load settings.ini field {key_error}. Update fprime-util.",
93-
end=";", file=sys.stderr,
93+
end=";",
94+
file=sys.stderr,
9495
)
9596
# Print the last setting with no ending to prevent null-entry at list end
9697
print_setting("FPRIME_SETTINGS_FILE", args_ns.settings, ending="")

cmake/test/src/cmake.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,19 @@ def subprocess_helper(args, cwd):
2828
"""Subprocess helper used to 'tee' the output to: console and capture"""
2929

3030
def read_available(proc, stdout, stderr):
31-
""" Read the available output from the process and return it """
31+
"""Read the available output from the process and return it"""
32+
3233
def capture_stream(stream, lines):
33-
""" Capture output from a stream, printing to console if needed """
34+
"""Capture output from a stream, printing to console if needed"""
3435
new_lines = stream.readlines()
3536
lines[stream].extend(new_lines)
3637
if "-s" in sys.argv or "--capture=no" in sys.argv:
3738
for line in new_lines:
38-
print(line, end="", file=(sys.stdout if stream == stdout else sys.stderr))
39+
print(
40+
line,
41+
end="",
42+
file=(sys.stdout if stream == stdout else sys.stderr),
43+
)
3944

4045
lines = {stdout: [], stderr: []}
4146
while proc.poll() is None:
@@ -109,7 +114,11 @@ def assert_process_success(data_object, errors_ok=False, targets=None):
109114
assert not stderr or errors_ok, f"CMake generated errors:\n{''.join(stderr)}"
110115

111116
targets = data_object["targets"].keys() if targets is None else targets
112-
filtered = [(target, output) for target, output in data_object["targets"].items() if target in targets]
117+
filtered = [
118+
(target, output)
119+
for target, output in data_object["targets"].items()
120+
if target in targets
121+
]
113122

114123
for target, output in filtered:
115124
return_code, stdout, stderr = output

cmake/test/src/test_config.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
]
2121
),
2222
},
23-
make_targets=["TestModelOverride", "TestHeaderOverride", "TestFPrimeLibraryOverride", "library_config", "TestLibraryNewConfig"],
23+
make_targets=[
24+
"TestModelOverride",
25+
"TestHeaderOverride",
26+
"TestFPrimeLibraryOverride",
27+
"library_config",
28+
"TestLibraryNewConfig",
29+
],
2430
)
2531

2632
_2 = cmake.get_build(
@@ -55,6 +61,7 @@
5561
make_targets=[],
5662
)
5763

64+
5865
def test_fprime_model_override(CONFIG_BUILD):
5966
"""Test that the config override works"""
6067
cmake.assert_process_success(CONFIG_BUILD, targets=["TestModelOverride"])
@@ -79,12 +86,14 @@ def test_library_new_config(CONFIG_BUILD):
7986
"""Test that the new config (of library) works"""
8087
cmake.assert_process_success(CONFIG_BUILD, targets=["TestLibraryNewConfig"])
8188

89+
8290
def test_library_bad_new_config(CONFIG_FAILED_NEW_FILE_BUILD):
8391
"""Test that the new config that accidentally overrides work works"""
8492
with pytest.raises(AssertionError):
8593
cmake.assert_process_success(CONFIG_FAILED_NEW_FILE_BUILD, targets=[])
8694

95+
8796
def test_library_bad_override_config(CONFIG_FAILED_OVERRIDE_BUILD):
8897
"""Test that the config that is not an override overrides work works"""
8998
with pytest.raises(AssertionError):
90-
cmake.assert_process_success(CONFIG_FAILED_OVERRIDE_BUILD, targets=[])
99+
cmake.assert_process_success(CONFIG_FAILED_OVERRIDE_BUILD, targets=[])

0 commit comments

Comments
 (0)