Commit 9cba124b authored by Sebastien Robin's avatar Sebastien Robin

display the name of the test currently running


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1977 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d30dfc5c
...@@ -8,6 +8,8 @@ __version__ = '0.3.0' ...@@ -8,6 +8,8 @@ __version__ = '0.3.0'
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
from Products.ERP5Type import product_path
from zLOG import LOG
# Std Zope Products # Std Zope Products
ZopeTestCase.installProduct('ExtFile') ZopeTestCase.installProduct('ExtFile')
...@@ -73,6 +75,11 @@ portal_name = 'erp5_portal' ...@@ -73,6 +75,11 @@ portal_name = 'erp5_portal'
class ERP5TypeTestCase(PortalTestCase): class ERP5TypeTestCase(PortalTestCase):
def getTitle(self):
"""
"""
return "Default Title of Test"
def getPortalName(self): def getPortalName(self):
""" """
Return the name of a portal for this test case. Return the name of a portal for this test case.
...@@ -107,8 +114,22 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -107,8 +114,22 @@ class ERP5TypeTestCase(PortalTestCase):
cfg.instancehome = os.environ['COPY_OF_INSTANCE_HOME'] cfg.instancehome = os.environ['COPY_OF_INSTANCE_HOME']
App.config.setConfiguration(cfg) App.config.setConfiguration(cfg)
setupERP5Site(business_template_list = self.getBusinessTemplateList(), template_list = self.getBusinessTemplateList()
portal_name = self.getPortalName()) new_template_list = []
LOG('template_list',0,template_list)
for template in template_list:
id = template
try:
from urllib import urlretrieve
file, headers = urlretrieve(template)
except IOError:
template = product_path + '/tests/' + template
template = '%s.bt5' % template
new_template_list.append((template,id))
LOG('new_template_list',0,template_list)
setupERP5Site(business_template_list = new_template_list,
portal_name = self.getPortalName(),title = self.getTitle())
PortalTestCase.setUp(self) PortalTestCase.setUp(self)
def afterSetUp(self): def afterSetUp(self):
...@@ -173,7 +194,7 @@ class ERP5TypeTestCase(PortalTestCase): ...@@ -173,7 +194,7 @@ class ERP5TypeTestCase(PortalTestCase):
self.assertEquals(len(a),len(b)) self.assertEquals(len(a),len(b))
def setupERP5Site(business_template_list=(), app=None, portal_name=portal_name, quiet=0): def setupERP5Site(business_template_list=(), app=None, portal_name=portal_name, title='',quiet=0):
''' '''
Creates an ERP5 site. Creates an ERP5 site.
business_template_list must be specified correctly (e.g. '("erp5_common", )'). business_template_list must be specified correctly (e.g. '("erp5_common", )').
...@@ -201,10 +222,10 @@ def setupERP5Site(business_template_list=(), app=None, portal_name=portal_name, ...@@ -201,10 +222,10 @@ def setupERP5Site(business_template_list=(), app=None, portal_name=portal_name,
setattr(app,'isIndexable',0) setattr(app,'isIndexable',0)
# VERY IMPORTANT: Add some business templates # VERY IMPORTANT: Add some business templates
#for (id,path) in business_template_list: #for (id,path) in business_template_list:
for id in business_template_list: for url,id in business_template_list:
ZopeTestCase._print('Adding %s business template ... \n' % id) ZopeTestCase._print('Adding %s business template ... \n' % id)
#portal.portal_templates.download('%s.zexp' % id, id=id) #portal.portal_templates.download('%s.zexp' % id, id=id)
portal.portal_templates.download('%s.bt5' % id, id=id) portal.portal_templates.download(url, id=id)
portal.portal_templates[id].install() portal.portal_templates[id].install()
# Enbable reindexing # Enbable reindexing
setattr(app,'isIndexable',1) setattr(app,'isIndexable',1)
...@@ -212,6 +233,7 @@ def setupERP5Site(business_template_list=(), app=None, portal_name=portal_name, ...@@ -212,6 +233,7 @@ def setupERP5Site(business_template_list=(), app=None, portal_name=portal_name,
if not quiet: ZopeTestCase._print('Logout ... \n') if not quiet: ZopeTestCase._print('Logout ... \n')
noSecurityManager() noSecurityManager()
if not quiet: ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,)) if not quiet: ZopeTestCase._print('done (%.3fs)\n' % (time.time()-_start,))
if not quiet: ZopeTestCase._print('Ran Unit test of %s\n' % title)
finally: finally:
get_transaction().commit() get_transaction().commit()
ZopeTestCase.close(app) ZopeTestCase.close(app)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment