Skip to content

Commit

Permalink
Merge pull request #358 from kdsudac/example_tweaks
Browse files Browse the repository at this point in the history
few fixes for docs and examples
  • Loading branch information
grybmadsci authored Jul 13, 2016
2 parents 3a86287 + c12ac39 commit bc12c68
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ htmlcov/
# virtualenv
env/
venv/
.env

# built protos
*_pb2.py
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion examples/all_the_things.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion openhtf/io/output/mfg_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Binary file modified test/io/output/record.testrun
Binary file not shown.

0 comments on commit bc12c68

Please sign in to comment.