Skip to content

Commit ad32cf9

Browse files
committed
correctly handle whitespace-only lines
1 parent 2ef17bd commit ad32cf9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

easybuild/framework/easyconfig/format/one.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def grab_more_comment_lines(lines, param_key):
391391
line = lines.pop(0)
392392
_, actual_comment = split_on_comment_hash(line, param_key)
393393
# prefix comment with '#' unless line was empty
394-
if line:
394+
if line.strip():
395395
actual_comment = '# ' + actual_comment
396396
comment_lines.append(actual_comment.strip())
397397

test/framework/easyconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,7 +1900,7 @@ def test_dump_comments(self):
19001900
"#",
19011901
"# which may include empty comment lines",
19021902
" # weirdly indented lines",
1903-
'',
1903+
' ', # whitespace-only line, should get stripped (but no # added)
19041904
"# or flat out empty lines",
19051905
'',
19061906
"easyblock = 'ConfigureMake'",

0 commit comments

Comments
 (0)