aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/specification_parser.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2018-08-20 14:23:46 +0200
committerTibor Frank <tifrank@cisco.com>2018-08-22 13:12:38 +0000
commit4ac3464851ff9dd688ab25d0324573284b6bf274 (patch)
treebe4b7456d9c5d30e4d81e107d79af8847d144d5c /resources/tools/presentation/specification_parser.py
parent68c245727d68fc7ba84b7f494a1dbcb69910213e (diff)
CSIT-944: PAL Extensions: Mapping table
Change-Id: I3bebf9ad849c056d2bbac476d22ef5e077af05b3 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/specification_parser.py')
-rw-r--r--resources/tools/presentation/specification_parser.py70
1 files changed, 59 insertions, 11 deletions
diff --git a/resources/tools/presentation/specification_parser.py b/resources/tools/presentation/specification_parser.py
index ebd84530a3..f994a59b35 100644
--- a/resources/tools/presentation/specification_parser.py
+++ b/resources/tools/presentation/specification_parser.py
@@ -94,20 +94,23 @@ class Specification(object):
return self._specification["static"]
@property
- def is_debug(self):
- """Getter - debug mode
+ def mapping(self):
+ """Getter - Mapping.
- :returns: True if debug mode is on, otherwise False.
- :rtype: bool
+ :returns: Mapping of the old names of test cases to the new (actual)
+ one.
+ :rtype: dict
"""
+ return self._specification["configuration"]["mapping"]
- try:
- if self.environment["configuration"]["CFG[DEBUG]"] == 1:
- return True
- else:
- return False
- except KeyError:
- return False
+ @property
+ def ignore(self):
+ """Getter - Ignore list.
+
+ :returns: List of ignored test cases.
+ :rtype: list
+ """
+ return self._specification["configuration"]["ignore"]
@property
def input(self):
@@ -413,6 +416,51 @@ class Specification(object):
build_nr = self._get_build_number(job, build_nr)
builds = [x for x in range(builds["start"], build_nr+1)]
self.configuration["data-sets"][set_name][job] = builds
+
+ # Mapping table:
+ mapping = None
+ mapping_file_name = self._specification["configuration"].\
+ get("mapping-file", None)
+ if mapping_file_name:
+ logging.debug("Mapping file: '{0}'".format(mapping_file_name))
+ try:
+ with open(mapping_file_name, 'r') as mfile:
+ mapping = load(mfile)
+ logging.debug("Loaded mapping table:\n{0}".format(mapping))
+ except (YAMLError, IOError) as err:
+ raise PresentationError(
+ msg="An error occurred while parsing the mapping file "
+ "'{0}'.".format(mapping_file_name),
+ details=repr(err))
+ # Make sure everything is lowercase
+ if mapping:
+ self._specification["configuration"]["mapping"] = \
+ {key.lower(): val.lower() for key, val in mapping.iteritems()}
+ else:
+ self._specification["configuration"]["mapping"] = dict()
+
+ # Ignore list:
+ ignore = None
+ ignore_list_name = self._specification["configuration"].\
+ get("ignore-list", None)
+ if ignore_list_name:
+ logging.debug("Ignore list file: '{0}'".format(ignore_list_name))
+ try:
+ with open(ignore_list_name, 'r') as ifile:
+ ignore = load(ifile)
+ logging.debug("Loaded ignore list:\n{0}".format(ignore))
+ except (YAMLError, IOError) as err:
+ raise PresentationError(
+ msg="An error occurred while parsing the ignore list file "
+ "'{0}'.".format(ignore_list_name),
+ details=repr(err))
+ # Make sure everything is lowercase
+ if ignore:
+ self._specification["configuration"]["ignore"] = \
+ [item.lower() for item in ignore]
+ else:
+ self._specification["configuration"]["ignore"] = list()
+
logging.info("Done.")
def _parse_input(self):