google / google/openhtf

Test Record is not JSON Serializable

Open
#970 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
722
Forks
237
Avg merge
11h 31m
Merged PRs (30d)
4

Description

Using the "all_the_things.py" example, if manufacturing inspector output is enabled, an exception is thrown due to the test record not able to be serialised. Running on Windows 10 not that it probably is applicable.

The error occurs on line 168 of mfg_event_converter.py:

`attachment.value_binary = _convert_object_to_json(test_record_dict)`

Example of how to reproduce:

```
# Example of how to output to testrun protobuf format and save to disk then
# upload. Replace json_file with your JSON-formatted private key downloaded
# from Google Developers Console when you created the Service Account you
# intend to use, or name it 'my_private_key.json'.
import json
from openhtf.output.proto.mfg_event_converter import mfg_event_from_test_record
inspector = (mfg_inspector.MfgInspector.from_json(json.load(open('test.json')))).set_converter(mfg_event_from_test_record)
test.add_output_callbacks(inspector.save_to_disk('mfg_event_{dut_id}_{start_time_millis}.pb'))

test.execute(test_start=user_input.prompt_for_test_start())
```

Note that I am only mucking around with manufacturing inspector files as want to get the file history display in the web gui working. Although I cannot see any use of protobufs in the web gui. Just the station server supplying .pb files.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.