Skip to content

Commit f120525

Browse files
authored
Merge pull request #1257 from douglasjacobsen/fix-squash-format-multiline-str
Fix squash of multiline strings
2 parents 7d997d3 + e416e86 commit f120525

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/ramble/ramble/test/cmd/workspace.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,6 +2858,9 @@ def test_workspace_config_squash(workspace_name, capsys):
28582858
foo: bar
28592859
n_ranks: 1
28602860
test_var: test_value
2861+
test_multiline_str: |-
2862+
This is a multi-line
2863+
String in YAML
28612864
"""
28622865

28632866
test_software_include = """software:
@@ -2949,6 +2952,7 @@ def test_workspace_config_squash(workspace_name, capsys):
29492952
assert "test_var: test_value" in config_output
29502953
assert "gcc" in config_output
29512954
assert "pkg_spec: [email protected]" in config_output
2955+
assert "test_multiline_str: |-" in config_output
29522956

29532957
with open(ws.config_file_path, "w+") as f:
29542958
f.write(config_output)

lib/ramble/ramble/workspace/workspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ def squash_and_print_config(self, included_section=None, excluded_section=None):
11331133
if section_dict:
11341134
workspace_dict["ramble"][section] = section_dict
11351135

1136-
print(f"\n{syaml.dump(workspace_dict)}")
1136+
print(f"\n{syaml.dump(workspace_dict, Dumper=syaml.OrderedLineDumper)}")
11371137

11381138
def add_experiments(
11391139
self,

0 commit comments

Comments
 (0)