Commit 4298ca21 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Make the output nicer. Decrease the number of documents, as it was too slow to run those tests.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37649 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68b03c82
...@@ -278,7 +278,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -278,7 +278,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
after_time = time() after_time = time()
amount_of_time = after_time - before_time amount_of_time = after_time - before_time
min_time, max_time = self._getMinMaxTime(target) min_time, max_time = self._getMinMaxTime(target)
print "%s took %.4f (%.4f < %.4f < %.4f)" \ print "\n%s took %.4f (%.4f < %.4f < %.4f)" \
% (target, amount_of_time, min_time, amount_of_time, max_time) % (target, amount_of_time, min_time, amount_of_time, max_time)
# Reset the target to make sure that the same target is not # Reset the target to make sure that the same target is not
# measured again. # measured again.
...@@ -286,6 +286,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -286,6 +286,7 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
# Set the result. # Set the result.
result = sequence.get('result', []) result = sequence.get('result', [])
result.append((target, min_time, amount_of_time, max_time)) result.append((target, min_time, amount_of_time, max_time))
sequence.edit(result=result)
def stepMeasureCreationOfNewAppliedRules(self, sequence=None, def stepMeasureCreationOfNewAppliedRules(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -479,8 +480,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -479,8 +480,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
self.assertAlmostEquals(line.getQuantity(), self.assertAlmostEquals(line.getQuantity(),
1.0 * number_of_sale_order_lines) 1.0 * number_of_sale_order_lines)
simulation_movement_list = line.getDeliveryRelatedValueList() simulation_movement_list = line.getDeliveryRelatedValueList()
self.assertEquals(len(simulation_movement_list), 1) self.assertEquals(len(simulation_movement_list),
simulation_movement = simulation_movement_list[0] number_of_sale_order_lines)
for simulation_movement in simulation_movement_list:
self.assertEquals(simulation_movement.getPortalType(), self.assertEquals(simulation_movement.getPortalType(),
'Simulation Movement') 'Simulation Movement')
self.assertEquals(simulation_movement.getCausality(), self.assertEquals(simulation_movement.getCausality(),
...@@ -744,10 +746,17 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -744,10 +746,17 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
if measurable: if measurable:
result = sequence.get('result') result = sequence.get('result')
if result: if result:
print ''
failure_list = []
for target, min_time, real_time, max_time in result: for target, min_time, real_time, max_time in result:
self.assertTrue(min_time < real_time < max_time, condition = (min_time < real_time < max_time)
'%s: %.4f < %.4f < %.4f' \ print '%s%s: %.4f < %.4f < %.4f' \
% (target, min_time, real_time, max_time)) % (condition and ' ' or '!',
target, min_time, real_time, max_time)
if not condition:
failure_list.append(target)
self.assertTrue(not failure_list,
'these tests failed: %s' % (', '.join(failure_list)))
def test_01_CheckLogicAndMakeCacheHot(self): def test_01_CheckLogicAndMakeCacheHot(self):
"""Check the correctness of the logic as well as making the cache hot. """Check the correctness of the logic as well as making the cache hot.
...@@ -764,9 +773,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -764,9 +773,9 @@ class TestSimulationPerformance(ERP5TypeTestCase, LogInterceptor):
""" """
message = 'Check Performance' message = 'Check Performance'
LOG('Testing... ', 0, message) LOG('Testing... ', 0, message)
self._checkSimulation(number_of_sale_orders=10, self._checkSimulation(number_of_sale_orders=5,
number_of_sale_order_lines=10, number_of_sale_order_lines=5,
number_of_additional_sale_packing_list_lines=10, number_of_additional_sale_packing_list_lines=5,
measurable=True) measurable=True)
def test_suite(): def test_suite():
......
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