[Erp5-report] r8477 - /erp5/trunk/products/ERP5Type/tests/Sequence.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jul 18 14:16:03 CEST 2006


Author: jerome
Date: Tue Jul 18 14:16:01 2006
New Revision: 8477

URL: http://svn.erp5.org?rev=8477&view=rev
Log:
support quiet argument to configure verbosity

Modified:
    erp5/trunk/products/ERP5Type/tests/Sequence.py

Modified: erp5/trunk/products/ERP5Type/tests/Sequence.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/Sequence.py?rev=8477&r1=8476&r2=8477&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/Sequence.py (original)
+++ erp5/trunk/products/ERP5Type/tests/Sequence.py Tue Jul 18 14:16:01 2006
@@ -42,7 +42,7 @@
     self._required = required
     self._max_replay = max_replay
 
-  def play(self,context,sequence=None):
+  def play(self, context, sequence=None, quiet=0):
     method_name = 'step' + self._method_name
     method = getattr(context,method_name)
     # We can in same cases replay many times the same step,
@@ -52,22 +52,24 @@
       if nb_replay==0:
         nb_replay=1
     for i in range(0,nb_replay):
-      ZopeTestCase._print('\n  Playing step... %s' % self._method_name)
-      LOG('Step.play',0,'Playing step... %s' % self._method_name)
+      if not quiet:
+        ZopeTestCase._print('\n  Playing step... %s' % self._method_name)
+        LOG('Step.play', 0, 'Playing step... %s' % self._method_name)
       method(sequence=sequence)
-    
+
 class Sequence:
 
   def __init__(self):
     self._step_list = []
     self._dict = {}
 
-  def play(self,context,sequence=None,sequence_number=0):
-    ZopeTestCase._print('\nStarting New Sequence %i... ' % sequence_number)
-    LOG('Sequence.play',0,'Starting New Sequence %i... ' % sequence_number)
+  def play(self, context, sequence=None, sequence_number=0, quiet=0):
+    if not quiet:
+      ZopeTestCase._print('\nStarting New Sequence %i... ' % sequence_number)
+      LOG('Sequence.play', 0, 'Starting New Sequence %i... ' % sequence_number)
     if sequence is None:
       for step in self._step_list:
-        step.play(context,sequence=self)
+        step.play(context, sequence=self, quiet=quiet)
         # commit transaction after each step
         get_transaction().commit()
 
@@ -76,7 +78,7 @@
                     required=required,max_replay=max_replay)
     self._step_list.append(new_step)
 
-  def set(self, keyword,value):
+  def set(self, keyword, value):
     self._dict[keyword]=value
 
   def edit(self, **kw):
@@ -109,14 +111,14 @@
     sequence = Sequence()
     for step in step_list:
       if step != '':
-        if step.startswith('step') : 
+        if step.startswith('step'):
           step = step[4:]
         sequence.addStep(step)
     self.addSequence(sequence)
 
-  def play(self, context):
+  def play(self, context, quiet=0):
     i = 1
     for sequence in self._sequence_list:
-      sequence.play(context,sequence_number=i)
+      sequence.play(context, sequence_number=i, quiet=quiet)
       i+=1
 




More information about the Erp5-report mailing list