From 57cecb27f51e855189e1a6d0b05a8e9ebd5611fc Mon Sep 17 00:00:00 2001 From: Jean-Emile DARTOIS Date: Tue, 8 Dec 2015 15:05:52 +0100 Subject: [PATCH] Remove pragma no cover from code Add exclude_lines in the report section of .coveragerc to ignore abstract in test coverage Change-Id: I7863a8ba7e20358fb7cdf3cc7e4d83871a5104ef --- .coveragerc | 2 ++ watcher/applier/action_plan/base.py | 3 +-- watcher/applier/base.py | 3 +-- watcher/applier/mapping/base.py | 3 +-- watcher/applier/primitives/base.py | 6 ++---- watcher/decision_engine/messaging/command/base.py | 3 +-- watcher/decision_engine/messaging/event_consumer.py | 2 +- watcher/decision_engine/planner/base.py | 3 +-- watcher/decision_engine/solution/base.py | 6 ++---- .../decision_engine/solution/solution_comparator.py | 3 +-- .../decision_engine/solution/solution_evaluator.py | 3 +-- watcher/decision_engine/strategy/context/base.py | 3 +-- watcher/decision_engine/strategy/selection/base.py | 3 +-- watcher/metrics_engine/cluster_history/api.py | 12 ++++-------- .../metrics_engine/cluster_model_collector/api.py | 3 +-- 15 files changed, 21 insertions(+), 37 deletions(-) diff --git a/.coveragerc b/.coveragerc index a3f73db5b..55a39d54f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,3 +5,5 @@ omit = watcher/tests/* [report] ignore_errors = True +exclude_lines = + @abstract diff --git a/watcher/applier/action_plan/base.py b/watcher/applier/action_plan/base.py index 4dee074a7..dbd40a6c0 100644 --- a/watcher/applier/action_plan/base.py +++ b/watcher/applier/action_plan/base.py @@ -25,5 +25,4 @@ import six class BaseActionPlanHandler(object): @abc.abstractmethod def execute(self): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/applier/base.py b/watcher/applier/base.py index 197cc3f05..039bd87d8 100644 --- a/watcher/applier/base.py +++ b/watcher/applier/base.py @@ -25,5 +25,4 @@ import six class BaseApplier(object): @abc.abstractmethod def execute(self, action_plan_uuid): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/applier/mapping/base.py b/watcher/applier/mapping/base.py index 4019c8f81..99f92e70b 100644 --- a/watcher/applier/mapping/base.py +++ b/watcher/applier/mapping/base.py @@ -30,5 +30,4 @@ class BaseActionMapper(object): :type action: watcher.decision_engine.action.BaseAction :return: the associated Primitive """ - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/applier/primitives/base.py b/watcher/applier/primitives/base.py index 29248b60e..64eadcc7a 100644 --- a/watcher/applier/primitives/base.py +++ b/watcher/applier/primitives/base.py @@ -26,11 +26,9 @@ class BasePrimitive(object): @Promise @abc.abstractmethod def execute(self): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() @Promise @abc.abstractmethod def undo(self): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/messaging/command/base.py b/watcher/decision_engine/messaging/command/base.py index 27a8ce45a..8d66dc380 100644 --- a/watcher/decision_engine/messaging/command/base.py +++ b/watcher/decision_engine/messaging/command/base.py @@ -24,5 +24,4 @@ import six class BaseDecisionEngineCommand(object): @abc.abstractmethod def execute(self): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/messaging/event_consumer.py b/watcher/decision_engine/messaging/event_consumer.py index 2b7c56563..19fc44942 100644 --- a/watcher/decision_engine/messaging/event_consumer.py +++ b/watcher/decision_engine/messaging/event_consumer.py @@ -36,4 +36,4 @@ class BaseEventConsumer(object): @abc.abstractmethod def execute(self, request_id, context, data): - raise NotImplementedError('Not implemented ...') # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/planner/base.py b/watcher/decision_engine/planner/base.py index 88e8b4d48..dde9053d9 100644 --- a/watcher/decision_engine/planner/base.py +++ b/watcher/decision_engine/planner/base.py @@ -33,5 +33,4 @@ class BasePlanner(object): and performance requirements are met. """ # example: directed acyclic graph - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/solution/base.py b/watcher/decision_engine/solution/base.py index 2716e7966..22a329650 100644 --- a/watcher/decision_engine/solution/base.py +++ b/watcher/decision_engine/solution/base.py @@ -53,10 +53,8 @@ class BaseSolution(object): @abc.abstractmethod def add_change_request(self, r): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() @abc.abstractproperty def actions(self): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/solution/solution_comparator.py b/watcher/decision_engine/solution/solution_comparator.py index fa88f1853..254cd6c03 100644 --- a/watcher/decision_engine/solution/solution_comparator.py +++ b/watcher/decision_engine/solution/solution_comparator.py @@ -24,5 +24,4 @@ import six class BaseSolutionComparator(object): @abc.abstractmethod def compare(self, sol1, sol2): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/solution/solution_evaluator.py b/watcher/decision_engine/solution/solution_evaluator.py index 6ebcce751..b36b70f4f 100644 --- a/watcher/decision_engine/solution/solution_evaluator.py +++ b/watcher/decision_engine/solution/solution_evaluator.py @@ -24,5 +24,4 @@ import six class BaseSolutionEvaluator(object): @abc.abstractmethod def evaluate(self, solution): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/strategy/context/base.py b/watcher/decision_engine/strategy/context/base.py index 706e47994..532b4e028 100644 --- a/watcher/decision_engine/strategy/context/base.py +++ b/watcher/decision_engine/strategy/context/base.py @@ -24,5 +24,4 @@ import six class BaseStrategyContext(object): @abc.abstractmethod def execute_strategy(self, model): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/decision_engine/strategy/selection/base.py b/watcher/decision_engine/strategy/selection/base.py index 6d59499c1..f0d74f9b4 100644 --- a/watcher/decision_engine/strategy/selection/base.py +++ b/watcher/decision_engine/strategy/selection/base.py @@ -24,5 +24,4 @@ import six class BaseSelector(object): @abc.abstractmethod def define_from_goal(self, goal_name): - raise NotImplementedError( - "Should have implemented this") # pragma:no cover + raise NotImplementedError() diff --git a/watcher/metrics_engine/cluster_history/api.py b/watcher/metrics_engine/cluster_history/api.py index 0c6e593d5..b89c330a5 100644 --- a/watcher/metrics_engine/cluster_history/api.py +++ b/watcher/metrics_engine/cluster_history/api.py @@ -27,18 +27,14 @@ class BaseClusterHistory(object): @abc.abstractmethod def statistic_aggregation(self, resource_id, meter_name, period, aggregate='avg'): - raise NotImplementedError( - "Should have implemented this") # pragma: nocover + raise NotImplementedError() @abc.abstractmethod def get_last_sample_values(self, resource_id, meter_name, limit=1): - raise NotImplementedError( - "Should have implemented this") # pragma: nocover + raise NotImplementedError() def query_sample(self, meter_name, query, limit=1): - raise NotImplementedError( - "Should have implemented this") # pragma: nocover + raise NotImplementedError() def statistic_list(self, meter_name, query=None, period=None): - raise NotImplementedError( - "Should have implemented this") # pragma: nocover + raise NotImplementedError() diff --git a/watcher/metrics_engine/cluster_model_collector/api.py b/watcher/metrics_engine/cluster_model_collector/api.py index e60228337..fada3fd63 100644 --- a/watcher/metrics_engine/cluster_model_collector/api.py +++ b/watcher/metrics_engine/cluster_model_collector/api.py @@ -24,5 +24,4 @@ import six class BaseClusterModelCollector(object): @abc.abstractmethod def get_latest_cluster_data_model(self): - raise NotImplementedError( - "Should have implemented this") # pragma: nocover + raise NotImplementedError()