Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions reframe/frontend/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ def add_argument(self, *flags, **kwargs):
kwargs['dest'] = opt_name

# Convert 'store_true' and 'store_false' actions to their
# 'store_const' equivalents, because they otherwise imply imply a
# default
# 'store_const' equivalents, because they otherwise imply a default
action = kwargs.get('action', None)
if action == 'store_true' or action == 'store_false':
kwargs['action'] = 'store_const'
Expand Down
3 changes: 2 additions & 1 deletion reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def main():
envvar='RFM_SAVE_LOG_FILES', configvar='general/save_log_files'
)
output_options.add_argument(
'--timestamp', action='store', nargs='?', const='', metavar='TIMEFMT',
'--timestamp', action='store', nargs='?', const='%FT%T',
metavar='TIMEFMT',
help=('Append a timestamp to the output and stage directory prefixes '
'(default: "%%FT%%T")'),
envvar='RFM_TIMESTAMP_DIRS', configvar='general/timestamp_dirs'
Expand Down
16 changes: 13 additions & 3 deletions unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pytest
import re
import sys
import time

import reframe.core.environments as env
import reframe.frontend.runreport as runreport
Expand Down Expand Up @@ -474,9 +475,7 @@ def test_execution_modes(run_reframe):


def test_timestamp_option(run_reframe):
from datetime import datetime

timefmt = datetime.now().strftime('xxx_%F')
timefmt = time.strftime('xxx_%F')
returncode, stdout, _ = run_reframe(
checkpath=['unittests/resources/checks'],
action='list',
Expand All @@ -486,6 +485,17 @@ def test_timestamp_option(run_reframe):
assert timefmt in stdout


def test_timestamp_option_default(run_reframe):
timefmt_date_part = time.strftime('%FT')
returncode, stdout, _ = run_reframe(
checkpath=['unittests/resources/checks'],
action='list',
more_options=['-R', '--timestamp']
)
assert returncode == 0
assert timefmt_date_part in stdout


def test_list_empty_prgenvs_check_and_options(run_reframe):
returncode, stdout, _ = run_reframe(
checkpath=['unittests/resources/checks/frontend_checks.py'],
Expand Down