Skip to content

Commit cb84bd2

Browse files
authored
extra cases
1 parent faf8f14 commit cb84bd2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

easybuild/tools/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ def fileprefix_from_cmd(cmd, allowed_chars=False):
186186
Simplify the cmd to only the allowed_chars we want in a filename
187187
188188
:param cmd: the cmd (string)
189-
:param allowed_chars: characters allowed in filename (defaults to string.ascii_letters + string.digits)
189+
:param allowed_chars: characters allowed in filename (defaults to string.ascii_letters + string.digits + "_-")
190190
"""
191191
if not allowed_chars:
192-
allowed_chars = string.ascii_letters + string.digits
192+
allowed_chars = f"{string.ascii_letters}{string.digits}_-"
193193

194194
return ''.join([c for c in cmd if c in allowed_chars])
195195

test/framework/run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def test_fileprefix_from_cmd(self):
200200
'abd123': 'abd123',
201201
'ab"a': 'aba',
202202
'a{:$:S@"a': 'aSa',
203+
'cmd-with-dash': 'cmd-with-dash',
204+
'cmd_with_underscore'. 'cmd_with_underscore',
203205
}
204206
for cmd, expected_simplification in cmds.items():
205207
self.assertEqual(fileprefix_from_cmd(cmd), expected_simplification)

0 commit comments

Comments
 (0)