|
25 | 25 | import openhtf as htf
|
26 | 26 | from openhtf import util
|
27 | 27 | from examples import all_the_things
|
| 28 | +from openhtf.core import phase_branches, phase_descriptor, phase_collections, phase_group |
28 | 29 | from openhtf.output.callbacks import console_summary
|
29 | 30 | from openhtf.output.callbacks import json_factory
|
30 | 31 | from openhtf.output.proto import mfg_event_converter
|
@@ -176,3 +177,25 @@ def test_outcome_colors(self):
|
176 | 177 | instance = console_summary.ConsoleSummary()
|
177 | 178 | for outcome in htf.test_record.Outcome:
|
178 | 179 | self.assertIn(outcome, instance.color_table)
|
| 180 | + |
| 181 | + def test_empty_outcome(self): |
| 182 | + """Console Summary must not crash if phases have been skipped.""" |
| 183 | + checkpoint = phase_branches.PhaseFailureCheckpoint.all_previous( |
| 184 | + "cp", action=phase_descriptor.PhaseResult.FAIL_SUBTEST) |
| 185 | + phasegroup = phase_group.PhaseGroup( |
| 186 | + lambda: htf.PhaseResult.FAIL_AND_CONTINUE, |
| 187 | + lambda: htf.PhaseResult.SKIP, |
| 188 | + checkpoint, |
| 189 | + ) |
| 190 | + subtest = phase_collections.Subtest("st", phasegroup) |
| 191 | + test = htf.Test(subtest) |
| 192 | + |
| 193 | + result_store = util.NonLocalResult() |
| 194 | + def _save_result(test_record): |
| 195 | + result_store.result = test_record |
| 196 | + test.add_output_callbacks( |
| 197 | + console_summary.ConsoleSummary(), _save_result) |
| 198 | + |
| 199 | + test.execute() |
| 200 | + assert not any("Traceback" in record.message |
| 201 | + for record in result_store.result.log_records) |
0 commit comments