From 97dbd35c75ee252a674aff3d66293d55fc0b35a5 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Mon, 10 Jun 2013 15:15:56 +0200 Subject: [Coverage] Move exception class in the relevant class BZ: 115218 Some exceptions were raised only by a particular class. As a result they were polluting the global namespace. Nested the exception class. Change-Id: Icde35d8d2f551a638b97d94bc0a770f70787c723 Signed-off-by: Kevin Rocard Reviewed-on: http://android.intel.com:8080/112710 Reviewed-by: Denneulin, Guillaume Reviewed-by: Gonzalve, Sebastien Reviewed-by: cactus Tested-by: Dixon, CharlesX Reviewed-by: buildbot Tested-by: buildbot --- tools/coverage.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'tools/coverage.py') diff --git a/tools/coverage.py b/tools/coverage.py index 6c4345c..f62fd9a 100755 --- a/tools/coverage.py +++ b/tools/coverage.py @@ -468,24 +468,28 @@ class CriteronStates(Element): currentcriteria.parentUsed() -class IneligibleConfigurationAppliedError(CustomError): - - def __init__(self, configuration, criteria): - self.configuration = configuration - self.criteria = criteria - - def __str__(self): - - return ("Applying ineligible %s, " - "rule:\n%s\n" - "Criteria current state:\n%s" % - (self.configuration, self.configuration.rootRule.dump(), self.criteria.dump())) class Configuration(FromDomElement, DomPopulatedElement): tag = "Configuration" childClasses = [] + class IneligibleConfigurationAppliedError(CustomError): + + def __init__(self, configuration, criteria): + self.configuration = configuration + self.criteria = criteria + + def __str__(self): + + return ("Applying ineligible %s, " + "rule:\n%s\n" + "Criteria current state:\n%s" % ( + self.configuration, + self.configuration.rootRule.dump(withCoverage=False, withNbUse=False), + self.criteria.dump(withCoverage=False, withNbUse=False) + )) + def __init__(self, DomElement): super().__init__(DomElement) @@ -520,7 +524,7 @@ class Configuration(FromDomElement, DomPopulatedElement): "criteria (parent: %s) " % self.parent.name, logging.FATAL) - raise IneligibleConfigurationAppliedError(self, criteria.export()) + raise self.IneligibleConfigurationAppliedError(self, criteria.export()) def _dumpPropagate(self, withCoverage, withNbUse): self.debug("Going to ask %s for description" % self.rootRule) -- cgit v1.1