[Erp5-report] r13162 - /erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 1 18:56:12 CET 2007
Author: romain
Date: Thu Mar 1 18:56:10 2007
New Revision: 13162
URL: http://svn.erp5.org?rev=13162&view=rev
Log:
Load locals Documents, PropertySheets, Constraints even if site already exists. Display which test is launched.
Modified:
erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=13162&r1=13161&r2=13162&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py Thu Mar 1 18:56:10 2007
@@ -23,6 +23,8 @@
Products.ERP5Type.Utils.get_request = get_request
Globals.get_request = get_request
+
+IS_PORTAL_EXISTING = 1
import itools.zope
@@ -491,6 +493,7 @@
business_template_list must be specified correctly
(e.g. '("erp5_base", )').
'''
+ global IS_PORTAL_EXISTING
if portal_name in failed_portal_installation:
raise RuntimeError, 'Installation of %s already failed, giving up'\
% portal_name
@@ -501,7 +504,9 @@
# make it's REQUEST available during setup
global current_app
current_app = app
+
if not hasattr(aq_base(app), portal_name):
+ IS_PORTAL_EXISTING = 0
try:
_start = time.time()
# Add user and log in
@@ -615,7 +620,7 @@
for dir in ('Constraint', 'Document', 'PropertySheet'):
os.system('rm -rf %s/%s.bak' % (instance_home, dir))
os.system('cp -ar %s/%s %s/%s.bak' % (instance_home, dir, instance_home, dir))
-
+
# Log out
if not quiet:
ZopeTestCase._print('Logout ... \n')
@@ -629,6 +634,22 @@
else:
get_transaction().commit()
ZopeTestCase.close(app)
+
+ if os.environ.get('erp5_load_data_fs'):
+ # Import local PropertySheets, Documents
+ # when loading an environnement
+ for id_ in getLocalPropertySheetList():
+ importLocalPropertySheet(id_)
+ for id_ in getLocalDocumentList():
+ importLocalDocument(id_)
+ for id_ in getLocalConstraintList():
+ importLocalConstraint(id_)
+
+ if IS_PORTAL_EXISTING == 1:
+ # Display which test is run when loading for the 1st time
+ IS_PORTAL_EXISTING = 0
+ ZopeTestCase._print('Ran Unit test of %s\n' % title)
+
except:
f = StringIO()
traceback.print_exc(file=f)
More information about the Erp5-report
mailing list