示例#1
0
    def __iter__(self):
        EVENT('scenario_outline', self)
        
        for ex in self.examples:
            EVENT('examples', ex)
            
            pattern = re.compile(r'<(%s)>' % '|'.join(ex.table.columns))
            self.current_columns = ex.table.columns
            self.current_widths = ex.table.widths
           
            for values in ex.table.rows:
                self.current_row = values
                # Substitute outline parameters.
                for step in self.steps:
                    step.name, used = subst_params(step.name_template, pattern, values)
                    if step.multi is not None:
                        if type(step.multi) == types.StringType:
                            # PyString
                            step.multi, used_in_multi = subst_params(step.multi_template, pattern, values)
                        else:
                            # Table
                            used_in_multi = step.multi.subst(pattern, values)
                        used |= used_in_multi
                    step.full_reset()
                    step.used_parameters = used
                Scenario.reset(self)
                yield self

        self.status = 'done'
        self.exception = None
        self.tb = None
        
        EVENT('scenario_outline', self)
示例#2
0
 def reset(self):
     Scenario.reset(self)
     self.current_columns = None
     self.current_widths = None
     self.current_row = None