From 38a6e9a566994580c215bd1fcb499c88a3a748d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 2 Oct 2013 10:58:32 +0200 Subject: [PATCH] hack to prevent keeping too many open files in testxhtml --- product/ERP5/tests/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/product/ERP5/tests/utils.py b/product/ERP5/tests/utils.py index 4df2b74cda..f5064c1ecf 100644 --- a/product/ERP5/tests/utils.py +++ b/product/ERP5/tests/utils.py @@ -40,6 +40,11 @@ else: from Products.ERP5Type.tests.backportUnittest import \ expectedFailure as newSimulationExpectedFailure +# Keep a global reference to a ZODB storage so that we can import business +# template xml files. XXX this connection will remain open. +db = DB(DemoStorage()) +connection = db.open() + class BusinessTemplateInfoBase: @@ -103,15 +108,12 @@ class BusinessTemplateInfoBase: def setUpActions(self): def parse(file_path): - db = DB(DemoStorage()) - _connection = db.open() - action_information = importXML(_connection, file_path) + action_information = importXML(connection, file_path) action_information.__repr__() for key, value in action_information.__dict__.iteritems(): if value not in (None, "") and key in ('action', 'condition') : setattr(action_information, key, value.text) actions = action_information.__dict__.copy() - db.close() return actions name = '%s/ActionTemplateItem/portal_types/' % self.getPrefix() -- GitLab