Commit fe219835 authored by Jérome Perrin's avatar Jérome Perrin

support quiet argument to configure verbosity


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8477 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 19263249
...@@ -42,7 +42,7 @@ class Step: ...@@ -42,7 +42,7 @@ class Step:
self._required = required self._required = required
self._max_replay = max_replay 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_name = 'step' + self._method_name
method = getattr(context,method_name) method = getattr(context,method_name)
# We can in same cases replay many times the same step, # We can in same cases replay many times the same step,
...@@ -52,8 +52,9 @@ class Step: ...@@ -52,8 +52,9 @@ class Step:
if nb_replay==0: if nb_replay==0:
nb_replay=1 nb_replay=1
for i in range(0,nb_replay): for i in range(0,nb_replay):
if not quiet:
ZopeTestCase._print('\n Playing step... %s' % self._method_name) ZopeTestCase._print('\n Playing step... %s' % self._method_name)
LOG('Step.play',0,'Playing step... %s' % self._method_name) LOG('Step.play', 0, 'Playing step... %s' % self._method_name)
method(sequence=sequence) method(sequence=sequence)
class Sequence: class Sequence:
...@@ -62,12 +63,13 @@ class Sequence: ...@@ -62,12 +63,13 @@ class Sequence:
self._step_list = [] self._step_list = []
self._dict = {} self._dict = {}
def play(self,context,sequence=None,sequence_number=0): def play(self, context, sequence=None, sequence_number=0, quiet=0):
if not quiet:
ZopeTestCase._print('\nStarting New Sequence %i... ' % sequence_number) ZopeTestCase._print('\nStarting New Sequence %i... ' % sequence_number)
LOG('Sequence.play',0,'Starting New Sequence %i... ' % sequence_number) LOG('Sequence.play', 0, 'Starting New Sequence %i... ' % sequence_number)
if sequence is None: if sequence is None:
for step in self._step_list: for step in self._step_list:
step.play(context,sequence=self) step.play(context, sequence=self, quiet=quiet)
# commit transaction after each step # commit transaction after each step
get_transaction().commit() get_transaction().commit()
...@@ -76,7 +78,7 @@ class Sequence: ...@@ -76,7 +78,7 @@ class Sequence:
required=required,max_replay=max_replay) required=required,max_replay=max_replay)
self._step_list.append(new_step) self._step_list.append(new_step)
def set(self, keyword,value): def set(self, keyword, value):
self._dict[keyword]=value self._dict[keyword]=value
def edit(self, **kw): def edit(self, **kw):
...@@ -109,14 +111,14 @@ class SequenceList: ...@@ -109,14 +111,14 @@ class SequenceList:
sequence = Sequence() sequence = Sequence()
for step in step_list: for step in step_list:
if step != '': if step != '':
if step.startswith('step') : if step.startswith('step'):
step = step[4:] step = step[4:]
sequence.addStep(step) sequence.addStep(step)
self.addSequence(sequence) self.addSequence(sequence)
def play(self, context): def play(self, context, quiet=0):
i = 1 i = 1
for sequence in self._sequence_list: for sequence in self._sequence_list:
sequence.play(context,sequence_number=i) sequence.play(context, sequence_number=i, quiet=quiet)
i+=1 i+=1
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