From c6a7ae9a4f9e1c65896649a2170fe004ce879dd0 Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Fri, 4 Nov 2005 13:20:51 +0000 Subject: [PATCH] Change the way of running unit tests. Now instead of having an instance home for testing manually, runUnitTest automatically creates an instance home under a real instance home. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4232 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/tests/runUnitTest.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py index 05c0afeed0..75f7cd7eed 100755 --- a/product/ERP5Type/tests/runUnitTest.py +++ b/product/ERP5Type/tests/runUnitTest.py @@ -7,11 +7,32 @@ import os, sys def getUnitTestFile() : return os.path.abspath(__file__) +def initializeInstanceHome(tests_framework_home, real_instance_home, instance_home): + if not os.path.exists(instance_home): + os.mkdir(instance_home) + for d in ('Constraint', 'Document', 'PropertySheet', 'tests', 'var'): + path = os.path.join(instance_home, d) + if not os.path.exists(path): + os.mkdir(path) + for d in ('Extensions', 'Products', 'bt5'): + src = os.path.join(real_instance_home, d) + dst = os.path.join(instance_home, d) + if not os.path.exists(dst): + os.symlink(src, dst) + src = os.path.join(tests_framework_home, 'custom_zodb.py') + dst = os.path.join(instance_home, 'custom_zodb.py') + if not os.path.exists(dst): + os.symlink(src, dst) + # site specific variables -instance_home = '/home/%s/zope' % os.environ['USER'] software_home = '/usr/lib/zope/lib/python' -tests_home = os.path.join(instance_home, 'tests') + tests_framework_home = os.path.dirname(os.path.abspath(__file__)) +real_instance_home = os.path.sep.join(tests_framework_home.split(os.path.sep)[:-3]) +instance_home = os.path.join(real_instance_home, 'unit_test') +tests_home = os.path.join(instance_home, 'tests') + +initializeInstanceHome(tests_framework_home, real_instance_home, instance_home) if '__INSTANCE_HOME' not in globals().keys() : __INSTANCE_HOME = instance_home -- 2.30.9