outcome_details not set for aborted phase run from test_start
- Dominant language
- Python
- Stars
- 722
- Forks
- 237
- Avg merge
- 11h 31m
- Merged PRs (30d)
- 4
Description
Here's some simplified code that aborts inside a phase run from `test_start`:
```python
import openhtf as htf
from openhtf.output.callbacks import console_summary
@htf.PhaseOptions(repeat_limit=1)
def repeat(test):
test.test_record.dut_id = '1'
return htf.PhaseResult.REPEAT
if __name__ == '__main__':
test = htf.Test()
test.add_output_callbacks(console_summary.ConsoleSummary())
test.execute(test_start=repeat)
```
In real life, this would show up if we are trying to get a DUT ID from user input and repeat if it's invalid.
The code triggers a bug when it gets to `ConsoleSummary` (assuming you're running with a version of `ConsoleSummary` that can handle `ABORT`—see #626):
```
2017-08-07 15:51:04,454 - ERROR - Phase returned REPEAT, exceeding repeat_limit.
Finishing test with outcome ABORTED.
Finishing test execution early due to test abortion, outcome ABORTED.
2017-08-07 15:51:04,457 - ERROR - Output callback raised; continuing anyway
Traceback (most recent call last):
File "/Users/dan/src/shaper/openhtf/openhtf/__init__.py", line 271, in execute
output_cb(final_state.test_record)
File "/Users/dan/src/shaper/openhtf/openhtf/output/callbacks/console_summary.py", line 70, in __call__
(self.indent, record.outcome_details[0].code))
IndexError: list index out of range
```
I have a patch for `ConsoleSummary` that prevents this error, but before I submit it I want to ask whether it makes more sense to fix the underlying issue, which is that `record.outcome_details` isn't being populated.
Contributor guide
Assessment
This issue has not been assessed yet.