Commit 3eddb0a4 authored by Julien Muchembled's avatar Julien Muchembled

collect: remove dead code

parent b29a79a6
...@@ -475,11 +475,6 @@ class ConsumptionReport(ConsumptionReportBase): ...@@ -475,11 +475,6 @@ class ConsumptionReport(ConsumptionReportBase):
return xml_report_path return xml_report_path
def _getAverageFromList(self, data_list):
if not data_list:
return 0
return sum(data_list)/len(data_list)
@withDB @withDB
def _getCpuLoadAverageConsumption(self, date_scope): def _getCpuLoadAverageConsumption(self, date_scope):
(cpu_load_percent_list,), = self.db.select("system", date_scope, (cpu_load_percent_list,), = self.db.select("system", date_scope,
......
...@@ -742,7 +742,6 @@ class TestConsumptionReportBase(unittest.TestCase): ...@@ -742,7 +742,6 @@ class TestConsumptionReportBase(unittest.TestCase):
def _get_file_content(self, f_path): def _get_file_content(self, f_path):
with open(f_path, "r") as f: with open(f_path, "r") as f:
return f.readlines() return f.readlines()
return []
def loadPredefinedDB(self): def loadPredefinedDB(self):
# populate db # populate db
...@@ -825,11 +824,6 @@ class TestConsumptionReport(TestConsumptionReportBase): ...@@ -825,11 +824,6 @@ class TestConsumptionReport(TestConsumptionReportBase):
location=self.temp_dir, location=self.temp_dir,
user_list=self.get_fake_user_list(15)) user_list=self.get_fake_user_list(15))
def test_get_average_from_list(self):
self.assertEqual(2, self.report._getAverageFromList([2, 2]))
self.assertEqual(0, self.report._getAverageFromList([]))
self.assertEqual(10, self.report._getAverageFromList(range(1, 20)))
def test_getCpuLoadAverageConsumption(self): def test_getCpuLoadAverageConsumption(self):
self.assertEqual(self.report._getCpuLoadAverageConsumption('2019-10-05'), 74.44468085106385) self.assertEqual(self.report._getCpuLoadAverageConsumption('2019-10-05'), 74.44468085106385)
self.assertEqual(self.report._getCpuLoadAverageConsumption('2019-10-06'), 74.99183673469388) self.assertEqual(self.report._getCpuLoadAverageConsumption('2019-10-06'), 74.99183673469388)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment