Skip to content

Commit c535ff5

Browse files
author
Vasileios Karakasis
committed
Fix timestamp value when --timestamp is passed no arguments
1 parent 024e517 commit c535ff5

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

reframe/frontend/argparse.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ def add_argument(self, *flags, **kwargs):
184184
kwargs['dest'] = opt_name
185185

186186
# Convert 'store_true' and 'store_false' actions to their
187-
# 'store_const' equivalents, because they otherwise imply imply a
188-
# default
187+
# 'store_const' equivalents, because they otherwise imply a default
189188
action = kwargs.get('action', None)
190189
if action == 'store_true' or action == 'store_false':
191190
kwargs['action'] = 'store_const'

reframe/frontend/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ def main():
217217
envvar='RFM_SAVE_LOG_FILES', configvar='general/save_log_files'
218218
)
219219
output_options.add_argument(
220-
'--timestamp', action='store', nargs='?', const='', metavar='TIMEFMT',
220+
'--timestamp', action='store', nargs='?', const='%FT%T',
221+
metavar='TIMEFMT',
221222
help=('Append a timestamp to the output and stage directory prefixes '
222223
'(default: "%%FT%%T")'),
223224
envvar='RFM_TIMESTAMP_DIRS', configvar='general/timestamp_dirs'

unittests/test_argparser.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def extended_parser():
104104
envvar='RFM_KEEP_STAGE_FILES', configvar='general/keep_stage_files'
105105
)
106106
foo_options.add_argument(
107-
'--timestamp', action='store', nargs='?', const='',
107+
'--timestamp', action='store',
108108
envvar='RFM_TIMESTAMP_DIRS', configvar='general/timestamp_dirs'
109109
)
110110
foo_options.add_argument(
@@ -180,10 +180,3 @@ def test_option_envvar_conversion_error(default_exec_ctx, extended_parser):
180180
options = extended_parser.parse_args(['--nocolor'])
181181
errors = options.update_config(site_config)
182182
assert len(errors) == 1
183-
184-
185-
def test_option_nargs(default_exec_ctx, extended_parser):
186-
site_config = rt.runtime().site_config
187-
options = extended_parser.parse_args(['--timestamp'])
188-
assert options.timestamp == ''
189-
assert site_config.get('general/0/timestamp_dirs') == '%FT%T'

0 commit comments

Comments
 (0)