| 1 |
jm |
41845 |
import glob, os, subprocess
|
| 2 |
|
|
# test_suite is provided by 'run_test_suite'
|
| 3 |
|
|
from test_suite import ERP5TypeTestSuite
|
| 4 |
|
|
|
| 5 |
|
|
class _ERP5(ERP5TypeTestSuite):
|
| 6 |
|
|
realtime_output = False
|
| 7 |
|
|
enabled_product_list = ('CMFActivity', 'CMFCategory', 'ERP5', 'ERP5Catalog',
|
| 8 |
|
|
'ERP5eGovSecurity', 'ERP5Form', 'ERP5Legacy',
|
| 9 |
jm |
43620 |
'ERP5OOo', 'ERP5Security', 'ERP5SyncML', 'ERP5Type',
|
| 10 |
jm |
44010 |
'ERP5VCS', 'ERP5Wizard', 'Formulator', 'ERP5Workflow',
|
| 11 |
rafael |
43666 |
'ERP5Configurator','HBTreeFolder2', 'MailTemplates',
|
| 12 |
|
|
'PortalTransforms', 'TimerService', 'ZLDAPConnection',
|
| 13 |
|
|
'ZLDAPMethods', 'ZMySQLDA', 'ZMySQLDDA', 'ZSQLCatalog')
|
| 14 |
jm |
41845 |
|
| 15 |
|
|
def enableProducts(self):
|
| 16 |
|
|
product_set = set(self.enabled_product_list)
|
| 17 |
|
|
try:
|
| 18 |
|
|
dir_set = set(os.walk('Products').next()[1])
|
| 19 |
|
|
for product in dir_set - product_set:
|
| 20 |
|
|
os.unlink(os.path.join('Products', product))
|
| 21 |
|
|
product_set -= dir_set
|
| 22 |
|
|
except StopIteration:
|
| 23 |
|
|
os.mkdir('Products')
|
| 24 |
|
|
for product in product_set:
|
| 25 |
|
|
os.symlink(os.path.join('..', 'products', product),
|
| 26 |
|
|
os.path.join('Products', product))
|
| 27 |
|
|
|
| 28 |
jm |
41863 |
def update(self):
|
| 29 |
jm |
41845 |
self.checkout('products', 'bt5')
|
| 30 |
|
|
self.enableProducts()
|
| 31 |
|
|
|
| 32 |
|
|
|
| 33 |
|
|
class PERF(_ERP5):
|
| 34 |
|
|
allow_restart = True
|
| 35 |
|
|
|
| 36 |
|
|
def getTestList(self):
|
| 37 |
|
|
return ('testPerformance',) * 3
|
| 38 |
|
|
|
| 39 |
|
|
def update(self):
|
| 40 |
|
|
self.checkout('products', 'bt5/erp5_base', 'bt5/erp5_ui_test')
|
| 41 |
|
|
self.enableProducts()
|
| 42 |
|
|
|
| 43 |
|
|
class ERP5(_ERP5):
|
| 44 |
|
|
mysql_db_count = 3
|
| 45 |
|
|
|
| 46 |
|
|
def getTestList(self):
|
| 47 |
|
|
test_list = []
|
| 48 |
|
|
for test_path in glob.glob('Products/*/tests/test*.py') + \
|
| 49 |
|
|
glob.glob('bt5/*/TestTemplateItem/test*.py'):
|
| 50 |
|
|
test_case = test_path.split(os.sep)[-1][:-3] # remove .py
|
| 51 |
|
|
product = test_path.split(os.sep)[-3]
|
| 52 |
|
|
# don't test 3rd party products
|
| 53 |
|
|
if product in ('PortalTransforms', 'MailTemplates'):
|
| 54 |
|
|
continue
|
| 55 |
|
|
# skip some tests
|
| 56 |
|
|
if test_case.startswith('testLive') or test_case.startswith('testVifib') \
|
| 57 |
|
|
or test_case in ('testPerformance', 'testSimulationPerformance'):
|
| 58 |
|
|
continue
|
| 59 |
|
|
test_list.append(test_case)
|
| 60 |
|
|
return test_list
|
| 61 |
|
|
|
| 62 |
|
|
def run(self, test):
|
| 63 |
|
|
if test in ('testConflictResolution', 'testInvalidationBug'):
|
| 64 |
|
|
status_dict = self.runUnitTest('--save', test)
|
| 65 |
|
|
if not status_dict['status_code']:
|
| 66 |
|
|
status_dict = self.runUnitTest('--load', '--activity_node=2', test)
|
| 67 |
|
|
return status_dict
|
| 68 |
|
|
return super(ERP5, self).run(test)
|
| 69 |
|
|
|
| 70 |
|
|
class ERP5_simulation(_ERP5):
|
| 71 |
|
|
|
| 72 |
|
|
def getTestList(self):
|
| 73 |
|
|
p = subprocess.Popen(('grep', '-lr', '--include=test*.py',
|
| 74 |
|
|
'-e', '@newSimulationExpectedFailure',
|
| 75 |
|
|
'-e', 'erp5_report_new_simulation_failures',
|
| 76 |
|
|
'Products/ERP5/tests'),
|
| 77 |
|
|
stdout=subprocess.PIPE)
|
| 78 |
|
|
return sorted(os.path.basename(x)[:-3]
|
| 79 |
|
|
for x in p.communicate()[0].splitlines())
|
| 80 |
|
|
|
| 81 |
|
|
def runUnitTest(self, *args, **kw):
|
| 82 |
|
|
return super(ERP5_simulation, self).runUnitTest(
|
| 83 |
|
|
erp5_report_new_simulation_failures='1', *args, **kw)
|