Fixed tests

This commit is contained in:
Anton Beloglazov 2012-10-22 16:46:34 +11:00
parent 728654f79a
commit 0b6ac7bdec

View File

@ -484,11 +484,11 @@ class Collector(TestCase):
with MockTransaction:
context = mock('context')
f = mock('file')
when(context).__enter__().and_return(f)#.once()
expect(context).__enter__().and_return(f).once()
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()
expect(collector).open('/proc/stat', 'r').and_return(context).once()
expect(f).readline().and_return(
'1 ' + ' '.join([str(v) for v in x]) + ' 2 3').once()
assert collector.get_host_cpu_time() == (float(sum(x)),
float(sum(x[0:3])))