aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-05-31 18:54:31 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-05-31 18:58:54 +0100
commit5e4d95ba299ce92588701d9481657c343b8ef609 (patch)
tree02ab2d7f0ae3c6c5d3f95879c0298d8b021adb9f
parentd6c1b8b7bfd257efd5fe2df30dd450bdb2c57c7d (diff)
Remove instantiated contexts in "test_task"
During unit testing, all contexts instantiated must be deleted at the end of the test to avoid clashes with other tests. JIRA: YARDSTICK-1209 Change-Id: I1994b915001b4a518e096833a0c5d33febbd8de6 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
-rw-r--r--yardstick/tests/unit/benchmark/core/test_task.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/yardstick/tests/unit/benchmark/core/test_task.py b/yardstick/tests/unit/benchmark/core/test_task.py
index 9e8e4e9f7..e7d2c70b7 100644
--- a/yardstick/tests/unit/benchmark/core/test_task.py
+++ b/yardstick/tests/unit/benchmark/core/test_task.py
@@ -357,6 +357,11 @@ key2:
}
}
+ @staticmethod
+ def _remove_context(context):
+ if context:
+ context._delete_context()
+
def test__change_node_names(self):
ctx_attrs = {
@@ -371,6 +376,7 @@ key2:
}
my_context = dummy.DummyContext()
+ self.addCleanup(self._remove_context, my_context)
my_context.init(ctx_attrs)
expected_scenario = {
@@ -413,6 +419,7 @@ key2:
}
my_context = dummy.DummyContext()
+ self.addCleanup(self._remove_context, my_context)
my_context.init(ctx_attrs)
scenario = copy.deepcopy(self.scenario)
@@ -428,6 +435,7 @@ key2:
}
my_context = dummy.DummyContext()
+ self.addCleanup(self._remove_context, my_context)
my_context.init(ctx_attrs)
scenario = copy.deepcopy(self.scenario)
scenario['options'] = None
@@ -442,6 +450,7 @@ key2:
}
my_context = dummy.DummyContext()
+ self.addCleanup(self._remove_context, my_context)
my_context.init(ctx_attrs)
scenario = copy.deepcopy(self.scenario)
scenario['options']['server_name'] = None