Skip to content

Commit f03d2b8

Browse files
committed
Add unit test for key results
1 parent b7b09ae commit f03d2b8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/tests/result_tests.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,3 +1123,38 @@ def test_flatten_results(self):
11231123

11241124
self.assertEqual(flattened, answer)
11251125
self.assertEqual(unflattened, answer)
1126+
1127+
def test_key_results(self):
1128+
"""Check that specifying key results causes those values to show up
1129+
in the results table."""
1130+
1131+
cfg = self._quick_test_cfg()
1132+
1133+
cfg['run']['cmds'] = [
1134+
'echo hello'
1135+
]
1136+
cfg['result_parse']['regex'] = {
1137+
'hello': {
1138+
'regex': 'hello',
1139+
}
1140+
}
1141+
cfg['key_results'] = ['hello']
1142+
1143+
test = self._quick_test(cfg, name="key_results_test")
1144+
run_result = test.run()
1145+
results = test.gather_results(run_result)
1146+
test.save_results(results)
1147+
1148+
result_cmd = commands.get_command('result')
1149+
result_cmd.silence()
1150+
1151+
arg_parser = arguments.get_parser()
1152+
res_args = arg_parser.parse_args(("result", test.full_id))
1153+
1154+
result_cmd.run(self.pav_cfg, res_args)
1155+
cmd_out, cmd_err = result_cmd.clear_output()
1156+
1157+
lines = cmd_out.split('\n')
1158+
1159+
self.assertIn("Hello", lines[2])
1160+
self.assertIn("hello", lines[4])

0 commit comments

Comments
 (0)