avocado_i2n.params_parser module¶
SUMMARY¶
Module for handling all Cartesian config parsing and making it reusable and maximally performant.
Copyright: Intra2net AG
INTERFACE¶
-
exception
avocado_i2n.params_parser.
EmptyCartesianProduct
(message)[source]¶ Bases:
Exception
Empty Cartesian product of variants
-
class
avocado_i2n.params_parser.
ParsedContent
(content)[source]¶ Bases:
object
Class for parsed content of a general type.
-
class
avocado_i2n.params_parser.
ParsedFile
(content)[source]¶ Bases:
avocado_i2n.params_parser.ParsedContent
Class for parsed content of file type.
-
class
avocado_i2n.params_parser.
ParsedStr
(content)[source]¶ Bases:
avocado_i2n.params_parser.ParsedContent
Class for parsed content of string type.
-
class
avocado_i2n.params_parser.
ParsedDict
(content)[source]¶ Bases:
avocado_i2n.params_parser.ParsedContent
Class for parsed content of dictionary type.
-
class
avocado_i2n.params_parser.
Reparsable
[source]¶ Bases:
object
Class to represent quickly parsable Cartesian configuration, producing both parser and parameters (parser dicts) on demand.
-
parse_next_file
(pfile)[source]¶ Add a file parsing step.
Parameters: pfile (str) – file to be parsed next If the parsable file has a relative form (not and absolute path), it will be searched in the relative test suite config directory.
-
parse_next_str
(pstring)[source]¶ Add a string parsing step.
Parameters: pstring (str) – string to be parsed next
-
parse_next_dict
(pdict)[source]¶ Add a dictionary parsing step.
Parameters: pdict ({str, str}) – dictionary to be parsed next
-
parse_next_batch
(base_file=None, base_str='', base_dict=None, ovrwrt_file=None, ovrwrt_str='', ovrwrt_dict=None)[source]¶ Parse a batch of base file, string, and dictionary, and possibly an overwrite file (with custom parameters at the user’s home location).
Parameters: - base_file (str or None) – file to be parsed first
- base_str (str or None) – string to be parsed first
- base_dict ({str, str} or None) – params to be added first
- ovrwrt_file (str or None) – file to be parsed last
- ovrwrt_str (str or None) – string to be parsed last
- ovrwrt_dict ({str, str} or None) – params to be added last
The priority of the setting follows the order of the arguments: Dictionary with some parameters is topmost, string with some parameters is next and the file with parameters is taken as a base. The overwriting version is taken last, the base version first.
-
-
avocado_i2n.params_parser.
all_restrictions
()[source]¶ Return all restrictions that can be passed for any test configuration.
Returns: all available (from configuration) vms Return type: [str]
-
avocado_i2n.params_parser.
all_objects
(key='vms', composites=None)[source]¶ Return all test objects that can be passed for any test configuration.
Param: str key: key to extract parametric objects from Parameters: composites ([str]) – composite restriction of the returned objects Returns: all available (from configuration) objects of a given type Return type: [str]
-
avocado_i2n.params_parser.
main_vm
()[source]¶ Return the default main vm that can be passed for any test configuration.
Returns: main available (from configuration) vm Return type: str or None
-
avocado_i2n.params_parser.
re_str
(variant_str, base_str='', tag='')[source]¶ Add a variant restriction to the base string, optionally adding a custom tag as well.
Parameters: - variant_str (str) – variant restriction
- base_str (str) – string where the variant restriction will be added
- tag (str) – additional tag to the variant combination
Returns: restricted parameter string
Return type: str
-
avocado_i2n.params_parser.
join_str
(variant_strs, base_str='')[source]¶ Join all object variant restrictions over the base string.
Parameters: - variant_strs ({str, str}) – variant restrictions for each object as key, value pair
- base_str (str) – string where the variant restriction will be added
Returns: restricted parameter string
Return type: str