Commit 253819f9 authored by Gabriel Monnerat's avatar Gabriel Monnerat

fix asserts. When openoffice is stopped, pid() should returns None

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@42231 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 530ef302
...@@ -58,6 +58,7 @@ class Application(object): ...@@ -58,6 +58,7 @@ class Application(object):
finally: finally:
if pid_exists(process_pid) or self.status(): if pid_exists(process_pid) or self.status():
Process(process_pid).kill() Process(process_pid).kill()
delattr(self, "process")
def loadSettings(self, hostname, port, path_run_dir, display_id, **kwargs): def loadSettings(self, hostname, port, path_run_dir, display_id, **kwargs):
"""Define attributes for application instance """Define attributes for application instance
......
...@@ -57,7 +57,7 @@ class TestOpenOffice(CloudoooTestCase): ...@@ -57,7 +57,7 @@ class TestOpenOffice(CloudoooTestCase):
"""Test pid function to validate if the return is correctly""" """Test pid function to validate if the return is correctly"""
self.assertNotEquals(self.openoffice.pid(), None) self.assertNotEquals(self.openoffice.pid(), None)
self.openoffice.stop() self.openoffice.stop()
self.assertNotEquals(self.openoffice.pid(), None) self.assertEquals(self.openoffice.pid(), None)
self.assertEquals(self.openoffice.status(), False) self.assertEquals(self.openoffice.status(), False)
def testOpenOfficeStart(self): def testOpenOfficeStart(self):
...@@ -106,7 +106,7 @@ class TestOpenOffice(CloudoooTestCase): ...@@ -106,7 +106,7 @@ class TestOpenOffice(CloudoooTestCase):
self.openoffice.start() self.openoffice.start()
second_openoffice = OpenOffice() second_openoffice = OpenOffice()
second_openoffice.loadSettings("localhost", 4091, second_openoffice.loadSettings("localhost", 4091,
self.working_path + "_", self.working_path,
self.virtual_display_id, self.virtual_display_id,
self.office_binary_path, self.office_binary_path,
self.uno_path, self.uno_path,
......
...@@ -26,10 +26,8 @@ ...@@ -26,10 +26,8 @@
# #
############################################################################## ##############################################################################
import unittest
from cloudoooTestCase import CloudoooTestCase, make_suite from cloudoooTestCase import CloudoooTestCase, make_suite
from cloudooo.handler.ooo.application.xvfb import Xvfb from cloudooo.handler.ooo.application.xvfb import Xvfb
from cloudooo.handler.ooo.utils.utils import waitStopDaemon
class TestXvfb(CloudoooTestCase): class TestXvfb(CloudoooTestCase):
...@@ -50,7 +48,7 @@ class TestXvfb(CloudoooTestCase): ...@@ -50,7 +48,7 @@ class TestXvfb(CloudoooTestCase):
self.assertNotEquals(self.xvfb.pid(), None) self.assertNotEquals(self.xvfb.pid(), None)
self.assertTrue(self.xvfb.status()) self.assertTrue(self.xvfb.status())
self.xvfb.stop() self.xvfb.stop()
self.assertNotEquals(self.xvfb.pid(), None) self.assertEquals(self.xvfb.pid(), None)
self.assertEquals(self.xvfb.status(), False) self.assertEquals(self.xvfb.status(), False)
def testStatus(self): def testStatus(self):
...@@ -61,7 +59,6 @@ class TestXvfb(CloudoooTestCase): ...@@ -61,7 +59,6 @@ class TestXvfb(CloudoooTestCase):
self.assertTrue(self.xvfb.status()) self.assertTrue(self.xvfb.status())
finally: finally:
self.xvfb.stop() self.xvfb.stop()
waitStopDaemon(self.xvfb)
self.assertFalse(self.xvfb.status()) self.assertFalse(self.xvfb.status())
......
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