Commit 5bf1de77 authored by Gabriel Monnerat's avatar Gabriel Monnerat

use 400 Mb in tests, accept lower memory usage

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@44079 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4f34be3e
...@@ -57,9 +57,9 @@ class TestMonitorMemory(unittest.TestCase): ...@@ -57,9 +57,9 @@ class TestMonitorMemory(unittest.TestCase):
self.monitor.terminate() self.monitor.terminate()
def testMonitorWithHugeMemoryLimit(self): def testMonitorWithHugeMemoryLimit(self):
"""Test the monitor with limit of 1Gb to the OpenOffice process""" """Test the monitor with limit of 400Mb to the OpenOffice process"""
try: try:
self.monitor = MonitorMemory(openoffice, 1, 1000) self.monitor = MonitorMemory(openoffice, 1, 400)
self.monitor.start() self.monitor.start()
sleep(6) sleep(6)
self.assertTrue(openoffice.status()) self.assertTrue(openoffice.status())
...@@ -80,7 +80,7 @@ class TestMonitorMemory(unittest.TestCase): ...@@ -80,7 +80,7 @@ class TestMonitorMemory(unittest.TestCase):
def testMonitorWithOpenOfficeStopped(self): def testMonitorWithOpenOfficeStopped(self):
"""Tests if the monitor continues to run even with openoffice stopped""" """Tests if the monitor continues to run even with openoffice stopped"""
openoffice.stop() openoffice.stop()
self.monitor = MonitorMemory(openoffice, 2, 1000) self.monitor = MonitorMemory(openoffice, 2, 400)
self.monitor.start() self.monitor.start()
try: try:
sleep(self.interval) sleep(self.interval)
...@@ -90,14 +90,14 @@ class TestMonitorMemory(unittest.TestCase): ...@@ -90,14 +90,14 @@ class TestMonitorMemory(unittest.TestCase):
def testCreateProcess(self): def testCreateProcess(self):
"""Test if the psutil.Process is create correctly""" """Test if the psutil.Process is create correctly"""
self.monitor = MonitorMemory(openoffice, 2, 1000) self.monitor = MonitorMemory(openoffice, 2, 400)
self.monitor.create_process() self.monitor.create_process()
self.assertTrue(hasattr(self.monitor, 'process')) self.assertTrue(hasattr(self.monitor, 'process'))
self.assertEquals(type(self.monitor.process), Process) self.assertEquals(type(self.monitor.process), Process)
def testGetMemoryUsage(self): def testGetMemoryUsage(self):
"""Test memory usage""" """Test memory usage"""
self.monitor = MonitorMemory(openoffice, 2, 1000) self.monitor = MonitorMemory(openoffice, 2, 400)
openoffice.stop() openoffice.stop()
memory_usage_int = self.monitor.get_memory_usage() memory_usage_int = self.monitor.get_memory_usage()
self.assertEquals(memory_usage_int, 0) self.assertEquals(memory_usage_int, 0)
......
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