[Erp5-report] r28401 - in /erp5/trunk/products/ERP5: Document/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Sun Aug 16 21:13:22 CEST 2009
Author: jm
Date: Sun Aug 16 21:13:22 2009
New Revision: 28401
URL: http://svn.erp5.org?rev=28401&view=rev
Log:
Fix TestERP5Administration.test_01_RunCheckStockTableAlarm
The test randomly failed since it was created because of low resolution of
creation_date column (in catalog table): Alarm.getLastActiveProcess failed
when the 2 last active processes were created in the same second.
This commit is a hack that relies on the fact that a new Active Process always
has an ID higher than previously created Active Processes.
Modified:
erp5/trunk/products/ERP5/Document/Alarm.py
erp5/trunk/products/ERP5/tests/testERP5Administration.py
Modified: erp5/trunk/products/ERP5/Document/Alarm.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Alarm.py?rev=28401&r1=28400&r2=28401&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Alarm.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Alarm.py [utf8] Sun Aug 16 21:13:22 2009
@@ -508,7 +508,9 @@
limit = self.isActive() and 2 or 1
active_process_list = self.getPortalObject().portal_catalog(
portal_type='Active Process', limit=limit,
- sort_on=(('creation_date', 'DESC'), ),
+ sort_on=(('creation_date', 'DESC'),
+ # XXX Work around poor resolution of MySQL dates.
+ ('CONVERT(`catalog`.`id`, UNSIGNED)', 'DESC')),
causality_uid=self.getUid())
if len(active_process_list) < limit:
process = None
Modified: erp5/trunk/products/ERP5/tests/testERP5Administration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Administration.py?rev=28401&r1=28400&r2=28401&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Administration.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Administration.py [utf8] Sun Aug 16 21:13:22 2009
@@ -38,7 +38,7 @@
return "ERP5Administration"
def getBusinessTemplateList(self):
- """
+ """
Same list as for Inventory API and add erp5_administration
"""
return InventoryAPITestCase.getBusinessTemplateList(self) + ('erp5_administration',)
@@ -53,7 +53,7 @@
alarm = portal.portal_alarms.check_stock
def checkActiveProcess(failed):
- transaction.get().commit()
+ transaction.commit()
self.tic()
self.assertEqual(alarm.getLastActiveProcess().ActiveProcess_sense(),
failed)
@@ -68,7 +68,7 @@
alarm.setAlarmNotificationMode('never')
mvt = self._makeMovement(quantity=1.23)
- transaction.get().commit()
+ transaction.commit()
self.tic()
alarm.activeSense()
checkActiveProcess(0)
More information about the Erp5-report
mailing list