Skip to content

Commit faac61a

Browse files
authored
Sync Diagnoses Library (#937)
* Update all_the_things for PY3. PiperOrigin-RevId: 294830845 * Update PhaseDescriptor.with_known_args for PY3 PiperOrigin-RevId: 295795634 * validators: Don't go through the converter when the min/max is not set. PiperOrigin-RevId: 299141301 * Treat string coordinates as single dimension PiperOrigin-RevId: 300597711 * openhtf/core/test_descriptor: log and print error stacktrace from output callback funcs. PiperOrigin-RevId: 300852825 * conf: Always use yaml.safe_load. PiperOrigin-RevId: 301297425 * Add transforms to measurements. Add the ability to transform measurement values on setting. Adding a built-in one for `with_precision` to automatically round floats. PiperOrigin-RevId: 301469616 * Initial attrs library support. The attrs library will be used to replace mutablerecords as part of introducing type annotations. PiperOrigin-RevId: 302761997 * test_state: Restructure phase context. Restructure the phase context to remove the hidden context in PhaseState. Instead, just have the running_phase_context call a finalize function in PhaseState to handle all the work. In addition, add the TestState to the PhaseState and remove optional variables. Lastly, include general readability improvements. PiperOrigin-RevId: 302824781 * conf_test: Don't modify actual command line for test. The conf_test wants to run argparse against the command line, but we can use alternate arguments to not modify the real command line. PiperOrigin-RevId: 302929683 * Test Executor: Log exceptions tracebacks. Log exceptions tracebacks for exceptions that occur in the TestExecutor thread to expose the underlying issues to the user. These can include plug issues that are not otherwise surfaced. PiperOrigin-RevId: 304090542 * util/test: Improve error logging and add test state. Improve the error logging when tests and phases fail to aid debugging. Adding a test_state variable to the test case that was just used during yields_phases to increase testability. Added a unit test that fails if one attempts to use yields_phases/patch_plugs without inheriting from openhtf.util.test.TestCase. Lastly, fixed lint issues. PiperOrigin-RevId: 304514879 * diagnoses_lib: Add Measurement and Meta Interpreters Add higher level signals that can process multiple measurements and phases to deliver actionable feedback for the manufacturing pipeline. PiperOrigin-RevId: 305086087 * Add debug logging for the phase outcome. PiperOrigin-RevId: 305344262 * exe_test: Fix flakiness when thread stopped too soon. The abort logic fails the thread abort exception occurs while the phase thread is still starting the abort thread. Adding an additional event to wait until ready to trigger the abort. PiperOrigin-RevId: 305944255 * Diagnoses: Add conditional validators. Add validators that are only used when a Diagnosis Result has been issued for the test. Fix measurements.py lint issues. Add a test state modification callback to openhtf.util.test.TestCase so tests can add test state or diagnoses prior to yielding phases. PiperOrigin-RevId: 306357852 * Diagnoses: Add DiagnosesStore to TestDiagnosers. Add DiagnosesStore as the second parameter to the run functions for TestDiagnoser. PiperOrigin-RevId: 306363506 * diagnoses: Add test case for a diagnosis generator that exceptions. PiperOrigin-RevId: 306964803 * Conditional Validators: as_base_types needs to return a dict, not a set PiperOrigin-RevId: 307078009 * Diagnoses: Add diagnosers to the test and phase records. PiperOrigin-RevId: 307487021 * Diagnoses: Make possible_results a property of Diagnosers. This allows output callbacks to directly use this information. PiperOrigin-RevId: 307724752 * diagnoses: Add always_fail to diagnosers. Add an `always_fail` field to diagnosers that cause the diagnoses created by the diagnoser to always have their `is_failure` field set to True. PiperOrigin-RevId: 313693148 * diagnoses_lib: Add always_fail to json serialization. PiperOrigin-RevId: 314197584 * Diagnoses: Make Diagnosis description optional. Default the the diagnosis descriptions to empty strings to leave setting them up to developers. Fixed the order of attr.ib calls so that types are first, then defaults, to add clarity. PiperOrigin-RevId: 316144472
1 parent 4fa142e commit faac61a

25 files changed

+2712
-207
lines changed

examples/all_the_things.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,23 @@
1818
python all_the_things.py
1919
"""
2020

21-
import time
21+
from __future__ import absolute_import
22+
from __future__ import division
23+
from __future__ import print_function
24+
2225
import os.path
26+
import time
2327

2428
import openhtf as htf
2529
from openhtf import util
26-
from openhtf.util import units
27-
from openhtf.plugs import user_input
30+
from examples import example_plugs
2831
from openhtf.output import callbacks
2932
from openhtf.output.callbacks import console_summary
3033
from openhtf.output.callbacks import json_factory
31-
32-
from examples import example_plugs
34+
from openhtf.plugs import user_input
35+
from openhtf.util import units
36+
from six.moves import range
37+
from six.moves import zip
3338

3439

3540
@htf.plug(example=example_plugs.ExamplePlug)
@@ -92,7 +97,7 @@ def set_measurements(test):
9297
def dimensions(test):
9398
for dim in range(5):
9499
test.measurements.dimensions[dim] = 1 << dim
95-
for x, y, z in zip(range(1, 5), range(21, 25), range (101, 105)):
100+
for x, y, z in zip(list(range(1, 5)), list(range(21, 25)), list(range(101, 105))):
96101
test.measurements.lots_of_dims[x, y, z] = x + y + z
97102

98103

openhtf/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
from openhtf import plugs
2222
from openhtf.core import phase_executor
2323
from openhtf.core import test_record
24+
from openhtf.core.diagnoses_lib import diagnose
25+
from openhtf.core.diagnoses_lib import Diagnosis
26+
from openhtf.core.diagnoses_lib import DiagnosisComponent
27+
from openhtf.core.diagnoses_lib import DiagPriority
28+
from openhtf.core.diagnoses_lib import DiagResultEnum
29+
from openhtf.core.diagnoses_lib import PhaseDiagnoser
30+
from openhtf.core.diagnoses_lib import TestDiagnoser
31+
2432
from openhtf.core.measurements import Dimension
2533
from openhtf.core.measurements import Measurement
2634
from openhtf.core.measurements import measures

0 commit comments

Comments
 (0)