Skip to content

Commit 65b1333

Browse files
author
Vasileios Karakasis
committed
Modify unit tests to increase coverage
1 parent 4548ea1 commit 65b1333

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

unittests/test_cli.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ def _run_reframe(system='generic:default',
7575
perflogdir=str(perflogdir)):
7676
import reframe.frontend.cli as cli
7777

78-
argv = ['./bin/reframe', '--prefix', str(tmp_path), '--nocolor']
78+
# We always pass the --report-file option, because we don't want to
79+
# pollute the user's home directory
80+
argv = ['./bin/reframe', '--prefix', str(tmp_path), '--nocolor',
81+
f'--report-file={tmp_path / "report.json"}']
7982
if mode:
8083
argv += ['--mode', mode]
8184

@@ -108,9 +111,6 @@ def _run_reframe(system='generic:default',
108111
if more_options:
109112
argv += more_options
110113

111-
# Always pass the --report-file option, because we don't want to
112-
# pollute the user's home directory
113-
argv += [f'--report-file={tmp_path / "report.json"}']
114114
return run_command_inline(argv, cli.main)
115115

116116
return _run_reframe
@@ -148,7 +148,19 @@ def test_check_success(run_reframe, tmp_path, logfile):
148148
assert 'PASSED' in stdout
149149
assert 'FAILED' not in stdout
150150
assert returncode == 0
151-
os.path.exists(tmp_path / 'output' / logfile)
151+
assert os.path.exists(tmp_path / 'output' / logfile)
152+
assert os.path.exists(tmp_path / 'report.json')
153+
154+
155+
def test_report_file_with_sessionid(run_reframe, tmp_path):
156+
returncode, stdout, _ = run_reframe(
157+
more_options=[
158+
f'--save-log-files',
159+
f'--report-file={tmp_path / "rfm-report-{sessionid}.json"}'
160+
]
161+
)
162+
assert returncode == 0
163+
assert os.path.exists(tmp_path / 'rfm-report-0.json')
152164

153165

154166
def test_check_submit_success(run_reframe, remote_exec_ctx):

0 commit comments

Comments
 (0)