From 4bf3b4ee48c4e3556e257aa77940f68c13b05b54 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 26 Sep 2017 17:49:47 +0200 Subject: Call pyuno.private_initTestEnvironment() only once ...instead of once for each class derived from CollectionsTestBase (as listed in pyuno/PythonTest_pyuno_pytests_testcollections.mk), causing the assert(!pSVData->maDeInitHook.IsSet()); in Application::setDeInitHook (vcl/source/app/svapp.cxx) to fire. This is probably far from being idiomatic Python code... Change-Id: I8cd1470c085b16b7b82468a308cfd1dead2db034 --- pyuno/qa/pytests/testcollections_base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pyuno') diff --git a/pyuno/qa/pytests/testcollections_base.py b/pyuno/qa/pytests/testcollections_base.py index b3fcd2eb92f8..d3e8068820cf 100644 --- a/pyuno/qa/pytests/testcollections_base.py +++ b/pyuno/qa/pytests/testcollections_base.py @@ -13,13 +13,17 @@ import uno from org.libreoffice.unotest import pyuno from com.sun.star.beans import PropertyValue +testEnvironmentInitialized = False class CollectionsTestBase(unittest.TestCase): @classmethod def setUpClass(cls): cls.context = pyuno.getComponentContext() - pyuno.private_initTestEnvironment() + global testEnvironmentInitialized + if not testEnvironmentInitialized: + pyuno.private_initTestEnvironment() + testEnvironmentInitialized = True def setUp(self): self._components = [] -- cgit