Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

Commit

Permalink
fixup! Allow per-product configuration of properties to use in metada…
Browse files Browse the repository at this point in the history
…ta conditionals.
  • Loading branch information
jgraham committed Nov 20, 2015
1 parent 064d8c0 commit aa99fab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
24 changes: 18 additions & 6 deletions wptrunner/manifestupdate.py
Expand Up @@ -56,7 +56,11 @@ def __init__(self, node, test_path=None, url_base=None, property_order=None,
:param node: AST Node associated with this object. If this is None,
a new AST is created to associate with this manifest.
:param test_path: Path of the test file associated with this manifest.
:param url_base: Base url for serving the tests in this manifest
:param url_base: Base url for serving the tests in this manifest.
:param property_order: List of properties to use in expectation metadata
from most to lest significant.
:param boolean_properties: Set of properties in property_order that should
be treated as boolean.
"""
if node is None:
node = DataNode(None)
Expand Down Expand Up @@ -319,7 +323,11 @@ def group_conditionals(values, property_order=None, boolean_properties=None):
(conditional_node, status) pairs representing the conditional
expressions that are required to match each status
:param values: List of Results"""
:param values: List of Results
:param property_order: List of properties to use in expectation metadata
from most to lest significant.
:param boolean_properties: Set of properties in property_order that should
be treated as boolean."""

by_property = defaultdict(set)
for run_info, status in values:
Expand All @@ -342,9 +350,6 @@ def group_conditionals(values, property_order=None, boolean_properties=None):
del by_property[key]

properties = set(item[0] for item in by_property.iterkeys())

if property_order is None:
property_order = ["debug", "os", "version", "processor", "bits"]
include_props = []

for prop in property_order:
Expand All @@ -366,7 +371,14 @@ def group_conditionals(values, property_order=None, boolean_properties=None):

def make_expr(prop_set, status, boolean_properties=None):
"""Create an AST that returns the value ``status`` given all the
properties in prop_set match."""
properties in prop_set match.
:param prop_set: tuple of (property name, value) pairs for each
property in this expression and the value it must match
:param status: Status on RHS when all the given properties match
:param boolean_properties: Set of properties in property_order that should
be treated as boolean.
"""
root = ConditionalNode()

assert len(prop_set) > 0
Expand Down
5 changes: 5 additions & 0 deletions wptrunner/products.py
Expand Up @@ -58,6 +58,11 @@ def load_product(config, product):


def load_product_update(config, product):
"""Return tuple of (property_order, boolean_properties) indicating the
run_info properties to use when constructing the expectation data for
this product. None for either key indicates that the default keys
appropriate for distinguishing based on platform will be used."""

module = product_module(config, product)
data = module.__wptrunner__

Expand Down

0 comments on commit aa99fab

Please sign in to comment.