python test shutdown robustness

so when a test fails, we don't get spurious additional stacktraces

Change-Id: Id2885be9ca628fc25a55f90f6c5c1b50f887a37a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104928
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel 2020-10-28 13:09:52 +02:00 committed by Noel Grandin
parent 4229467fa8
commit f2aca4e038
2 changed files with 8 additions and 6 deletions

View file

@ -23,7 +23,8 @@ class TestXControlShape(unittest.TestCase):
@classmethod
def tearDownClass(cls):
cls._uno.tearDown()
if cls._uno:
cls._uno.tearDown()
def test_getAndSetControlShape(self):
xDoc = self.__class__._uno.openDocFromTDOC("xcontrolshape.odt")

View file

@ -243,11 +243,12 @@ class UnoInProcess:
assert(self.xContext)
def tearDown(self):
if hasattr(self, 'xDoc'):
self.xDoc.close(True)
# HACK in case self.xDoc holds a UNO proxy to an SwXTextDocument (whose dtor calls
# Application::GetSolarMutex via sw::UnoImplPtrDeleter), which would potentially only be
# garbage-collected after VCL has already been deinitialized:
self.xDoc = None
if self.xDoc:
self.xDoc.close(True)
# HACK in case self.xDoc holds a UNO proxy to an SwXTextDocument (whose dtor calls
# Application::GetSolarMutex via sw::UnoImplPtrDeleter), which would potentially only be
# garbage-collected after VCL has already been deinitialized:
self.xDoc = None
def simpleInvoke(connection, test):
try: