def __call__(self, *args, **kw): """Method that actually wrapps the call to step definition callback. Sends step object as first argument """ try: ret = self.function(self.step, *args, **kw) self.step.passed = True except Exception, e: self.step.failed = True self.step.why = ReasonToFail(self.step, e) raise
step.pre_run(ignore_case, with_outline=outline) if run_callbacks: call_hook('before_each', 'step', step) if not steps_failed and not steps_undefined: step.run(ignore_case) steps_passed.append(step) except NoDefinitionFound, e: steps_undefined.append(e.step) except: e = sys.exc_info()[1] steps_failed.append(step) reasons_to_fail.append(step.why or ReasonToFail(e)) finally: all_steps.append(step) if run_callbacks: call_hook('after_each', 'step', step) return (all_steps, steps_passed, steps_failed, steps_undefined, reasons_to_fail) @classmethod def many_from_lines(klass, lines, filename = None, original_string = None): """Parses a set of steps from lines of input. This will correctly parse and produce a list of steps from lines without any Scenario: heading at the top. Examples in table form are correctly parsed, but must be well-formed under a regular step sentence.