pcvs.helpers.criterion module
- class pcvs.helpers.criterion.Combination(crit_desc, dict_comb)[source]
Bases:
object
A combination maps the actual concretization from multiple criterion.
For a given set of criterion, a Combination carries, for each kind, its associated value in order to generate the appropriate test
- get(k, dflt=None)[source]
Retrieve the actual value for a given combination element :type k: :param k: value to retrieve :type k: str :type dflt: :param dflt: default value if k is not a valid key :type: object
- translate_to_command()[source]
Translate the actual combination is tuple of three elements, based on the representation of each criterion in the test semantic. It builds tokens to provide to properly build the test command. It can either be:
an environment variable to export before the test to run (gathering system-scope and program-scope elements)
a runtime argument
a program-level argument (through custom-made iterators)
- class pcvs.helpers.criterion.Criterion(name, description, local=False, numeric=False)[source]
Bases:
object
A Criterion is the representation of a component each program (i.e. test binary) should be run against. A criterion comes with a range of possible values, each leading to a different test
- aliased_value(val)[source]
Check if the given value has an alias for the current criterion. An alias is the value replacement to use instead of the one defined by test configuration. This allows to split test logic from runtime semantics.
For instance, TEs manipulate ‘ib’ as a value to depict the ‘infiniband’ network layer. But once the test has to be built, the term will change depending on the runtime carrying it, the value may be different from a runtime to another :type val: :param val: string with aliases to be replaced
- concretize_value(val='')[source]
Return the exact string mapping this criterion, according to the specification. (is it aliased ? should the option be put before/after the value?…) :type val: :param val: value to add with prefix :type val: str :return: values with aliases replaced :rtype: str
- expand_values(reference=None)[source]
Browse values for the current criterion and make it ready to generate combinations
- property expanded
- intersect(other)[source]
Update the calling Criterion with the interesection of the current range of possible values with the one given as a parameters.
This is used to refine overriden per-TE criterion according to system-wide’s
- is_empty()[source]
Is the current set of values empty May lead to errors, as it may indicates no common values has been found between user and system specifications
- property max_value
- property min_value
- property name
Get the
name
attribute of this criterion.- Returns:
name of this criterion
- Return type:
- property numeric
Get the
numeric
attribute of this criterion.- Returns:
numeric of this criterion
- Return type:
- override(desc)[source]
- Replace the value of the criterion using a descriptor containing the
said value
- sanitize_values()[source]
Check for any inconsistent values in the current Criterion.
Currently, only scalar items or dict (=> sequence) are allowed. Will raise an exeption in case of inconsistency (Maybe this should be managed in another way through the error handling)
- property subtitle
Get the
subtitle
attribute of this criterion.- Returns:
subtitle of this criterion
- Return type:
- class pcvs.helpers.criterion.Serie(dict_of_criterion)[source]
Bases:
object
A serie ties a test expression (TEDescriptor) to the possible values which can be taken for each criterion to build test sets. A serie can be seen as the Combination generator for a given TEDescriptor