diff --git a/.gitignore b/.gitignore index 16a24cd1e..96e9ada71 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ htmlcov/ # virtualenv env/ venv/ +.env # built protos *_pb2.py diff --git a/README.md b/README.md index 81461144f..e940d4b51 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ The fastest way to get started is to take a look in the `examples/` directory, where you'll find sample test scripts and plugs. In addition, many of OpenHTF's modules are fairly well documented inline through the use of docstrings. +Note: some of the `examples/` require protocol buffer code to be generated via +`setup python.py build` command. This requires protocol buffer compiler +library to be installed +([additional instructions](CONTRIBUTING.md#setting-up-your-dev-environment)). ## Nomenclature OpenHTF uses certain nomenclature internally for several of its core concepts. diff --git a/examples/all_the_things.py b/examples/all_the_things.py index ef4800ab5..cf89dcab3 100644 --- a/examples/all_the_things.py +++ b/examples/all_the_things.py @@ -15,7 +15,7 @@ """Example OpenHTF test logic. Run with (your virtualenv must be activated first): -python all_the_things.py --config=example_config.yaml +python all_the_things.py """ import json diff --git a/examples/measurements.py b/examples/measurements.py index 88c1d8204..4ab9467d5 100644 --- a/examples/measurements.py +++ b/examples/measurements.py @@ -93,7 +93,7 @@ def LotsOfMeasurements(test): # describing the measurement. Validators can get quite complex, for more # details, see the validators.py example. @measures(Measurement('validated_measurement').InRange(0, 10).Doc( - 'This measurement is validated.').WithUnits(UOM['SECOND'])) + 'This measurement is validated.').WithUnits(units.SECOND)) def MeasureSeconds(test): # The 'outcome' of this measurement in the test_record result will be a PASS # because its value passes the validator specified (0 <= 5 <= 10). @@ -106,7 +106,7 @@ def MeasureSeconds(test): # must be a string containing the measurement name). If you want to specify # multiple measurements this way, you can stack multiple decorators. @measures('inline_kwargs', docstring='This measurement is declared inline!', - units=UOM['HERTZ'], validators=[validators.InRange(0, 10)]) + units=units.HERTZ, validators=[validators.InRange(0, 10)]) @measures('another_inline', docstring='Because why not?') def InlinePhase(test): # This measurement will have an outcome of FAIL, because the set value of 15 diff --git a/openhtf/io/output/mfg_inspector.py b/openhtf/io/output/mfg_inspector.py index 49d88aaf7..c18b97fee 100644 --- a/openhtf/io/output/mfg_inspector.py +++ b/openhtf/io/output/mfg_inspector.py @@ -119,7 +119,8 @@ def _PopulateHeader(record, testrun): if 'config' in record.metadata: attachment = testrun.info_parameters.add() attachment.name = 'config' - attachment.value_binary = str(record.metadata['config']) + attachment.value_binary = json.dumps( + record.metadata['config'], sort_keys=True, indent=4) def _EnsureUniqueParameterName(name, used_parameter_names): diff --git a/setup.py b/setup.py index d4a69ec89..743342238 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ def initialize_options(self): if platform.system() == 'Linux': # Default to /usr? prefix = '/usr' - elif platform.system() == 'Mac': + elif platform.system() in ['Mac', 'Darwin']: # Default to /usr/local for Homebrew prefix = '/usr/local' else: diff --git a/test/io/output/record.testrun b/test/io/output/record.testrun index 2a20dc934..857bfb3bd 100644 Binary files a/test/io/output/record.testrun and b/test/io/output/record.testrun differ