From 1e61c223a5e6b3eb397d412f3bd5e7fc98db590e Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Wed, 6 Jun 2018 17:46:02 +0200 Subject: [PATCH] Bugfix: Treat --timestamp option Also: - Add a unit test exposing the bug. --- reframe/frontend/cli.py | 3 +++ unittests/test_cli.py | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index 1f5eb4f4ae..0e0a68b6d4 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -279,6 +279,9 @@ def main(): "`--keep-stage-files' option.") sys.exit(1) + if options.timestamp: + rt.resources.timefmt = options.timestamp + # Setup the check loader if options.checkpath: load_path = [] diff --git a/unittests/test_cli.py b/unittests/test_cli.py index d267d65436..3708fad783 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -25,7 +25,6 @@ def run_command_inline(argv, funct, *args, **kwargs): captured_stdout = StringIO() captured_stderr = StringIO() - print(sys.argv) with redirect_stdout(captured_stdout): with redirect_stderr(captured_stderr): try: @@ -305,3 +304,16 @@ def test_no_ignore_check_conflicts(self): self.action = 'list' returncode, *_ = self._run_reframe() self.assertNotEqual(0, returncode) + + def test_timestamp_option(self): + from datetime import datetime + + self.checkpath = ['unittests/resources/checks'] + self.more_options = ['-R'] + self.ignore_check_conflicts = False + self.action = 'list' + self.more_options = ['--timestamp=xxx_%F'] + timefmt = datetime.now().strftime('xxx_%F') + returncode, stdout, _ = self._run_reframe() + self.assertNotEqual(0, returncode) + self.assertIn(timefmt, stdout)