Skip to content

Commit f702d6c

Browse files
committed
Make test_uid required in TestRecord
1 parent da7d426 commit f702d6c

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

openhtf/core/test_record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class TestRecord(object):
170170

171171
dut_id = attr.ib(type=Optional[Text])
172172
station_id = attr.ib(type=Text)
173+
test_uid = attr.ib(type=Text)
173174
dut_extended_id = attr.ib(type=Optional[DutIdentifier], default=None)
174175
start_time_millis = attr.ib(type=int, default=0)
175176
end_time_millis = attr.ib(type=Optional[int], default=None)
@@ -186,7 +187,6 @@ class TestRecord(object):
186187
diagnoses = attr.ib(type=List['diagnoses_lib.Diagnosis'], factory=list)
187188
log_records = attr.ib(type=List[logs.LogRecord], factory=list)
188189
marginal = attr.ib(type=Optional[bool], default=None)
189-
test_uid = attr.ib(type=Optional[Text], default=None)
190190

191191
# Cache fields to reduce repeated base type conversions.
192192
_cached_record = attr.ib(type=Dict[Text, Any], factory=dict)

test/core/exe_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,7 @@ def test_execute_repeat_on_measurement_fail_phase(self, phase, meas_value,
12181218
plug_manager=plugs.PlugManager(),
12191219
execution_uid='01234567890',
12201220
state_logger=mock.MagicMock(),
1221-
test_record=test_record.TestRecord('mock-dut-id', 'mock-station-id'))
1221+
test_record=test_record.TestRecord(dut_id='mock-dut-id', station_id='mock-station-id', test_uid='mock-test-uid'))
12221222
mock_test_state.plug_manager.initialize_plugs(
12231223
[UnittestPlug, MoreRepeatsUnittestPlug])
12241224
my_phase_record = test_record.PhaseRecord.from_descriptor(phase)

test/output/callbacks/mfg_event_converter_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def test_mfg_event_from_test_record(self):
5959
start_time_millis=1,
6060
end_time_millis=1,
6161
station_id='localhost',
62+
test_uid='testing-123',
6263
outcome=test_record.Outcome.PASS,
6364
marginal=False)
6465
record.outcome = test_record.Outcome.PASS
@@ -150,6 +151,7 @@ def test_populate_basic_data(self):
150151
record = test_record.TestRecord(
151152
dut_id='mock-dut-id',
152153
station_id='mock-station-id',
154+
test_uid='mock-test-uid',
153155
start_time_millis=100,
154156
end_time_millis=500,
155157
outcome=test_record.Outcome.PASS,
@@ -198,7 +200,7 @@ def test_populate_basic_data(self):
198200
self.assertEqual(mfg_event.test_logs[0].lineno, 123)
199201

200202
def test_attach_record_as_json(self):
201-
record = test_record.TestRecord('mock-dut-id', 'mock-station-id')
203+
record = test_record.TestRecord(dut_id='mock-dut-id', station_id='mock-station-id', test_uid='mock-test-uid',)
202204
mfg_event = mfg_event_pb2.MfgEvent()
203205
mfg_event_converter._attach_record_as_json(mfg_event, record)
204206

@@ -214,7 +216,7 @@ def test_convert_object_to_json_with_bytes(self):
214216

215217
def test_attach_config(self):
216218
record = test_record.TestRecord(
217-
'mock-dut-id', 'mock-station-id', metadata={'config': {
219+
dut_id='mock-dut-id', station_id='mock-station-id', test_uid='mock-test-uid', metadata={'config': {
218220
'key': 'value'
219221
}})
220222
mfg_event = mfg_event_pb2.MfgEvent()

test/util/text_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def testGetTestOutcomeHeadline_TestNotColorized(self, outcome, headline):
100100
record = test_record.TestRecord(
101101
dut_id='TestDutId',
102102
station_id='test_station',
103+
test_uid='testing-123',
103104
outcome=test_record.Outcome[outcome])
104105
self.assertEqual(text._GetTestOutcomeHeadline(record), headline)
105106

@@ -113,6 +114,7 @@ def testGetTestOutcomeHeadline_TestColorized(self, outcome, headline):
113114
record = test_record.TestRecord(
114115
dut_id='TestDutId',
115116
station_id='test_station',
117+
test_uid='testing-123',
116118
outcome=test_record.Outcome[outcome])
117119
# TODO(b/70517332): Pytype currently doesn't properly support the functional
118120
# API of enums: https://github.com/google/pytype/issues/459. Remove

0 commit comments

Comments
 (0)