diff --git a/neat/locals/collector.py b/neat/locals/collector.py index be7f90e..dbd4fa0 100644 --- a/neat/locals/collector.py +++ b/neat/locals/collector.py @@ -279,7 +279,8 @@ def execute(config, state): host_cpu_mhz) if log.isEnabledFor(logging.DEBUG): log.debug('Collected VM data: %s', str(cpu_mhz)) - log.debug('Overall host utilization: %s', str(host_cpu_mhz / state['physical_cpu_mhz'])) + log.debug('Overall host utilization: %s', + str(float(host_cpu_mhz) / state['physical_cpu_mhz'])) log.debug('Collected host CPU MHz: %s', str(host_cpu_mhz)) log.debug('Collected VM CPU MHz: %s', str(sum(cpu_mhz.values()))) log.debug('Collected host - VMs CPU MHz: %s', str(host_cpu_mhz - sum(cpu_mhz.values()))) diff --git a/tests/locals/test_collector.py b/tests/locals/test_collector.py index fe624d2..54d0b38 100644 --- a/tests/locals/test_collector.py +++ b/tests/locals/test_collector.py @@ -485,7 +485,7 @@ class Collector(TestCase): context = mock('context') f = mock('file') when(context).__enter__().and_return(f)#.once() - when(context).__exit__() + when(context).__exit__.and_return(True) when(collector).open('/proc/stat', 'r').and_return(context)#.once() when(f).readline().and_return( '1 ' + ' '.join([str(v) for v in x]) + ' 2 3')#.once()