Logo Search packages:      
Sourcecode: ubuntu-sso-client version File versions  Download package

def mocker::Event::run (   self,
  path 
) [inherited]

Run all tasks with the given action.

@param path: The path of the expression run.

Running an event means running all of its tasks individually and in
order.  An event should only ever be run if all of its tasks claim to
match the given action.

The result of this method will be the last result of a task
which isn't None, or None if they're all None.

Definition at line 1508 of file mocker.py.

01508                        :
        """Run all tasks with the given action.

        @param path: The path of the expression run.

        Running an event means running all of its tasks individually and in
        order.  An event should only ever be run if all of its tasks claim to
        match the given action.

        The result of this method will be the last result of a task
        which isn't None, or None if they're all None.
        """
        self._has_run = True
        result = None
        errors = []
        for task in self._tasks:
            try:
                task_result = task.run(path)
            except AssertionError, e:
                error = str(e)
                if not error:
                    raise RuntimeError("Empty error message from %r" % task)
                errors.append(error)
            else:
                if task_result is not None:
                    result = task_result
        if errors:
            message = [str(self.path)]
            if str(path) != message[0]:
                message.append("- Run: %s" % path)
            for error in errors:
                lines = error.splitlines()
                message.append("- " + lines.pop(0))
                message.extend(["  " + line for line in lines])
            raise AssertionError(os.linesep.join(message))
        return result

    def satisfied(self):


Generated by  Doxygen 1.6.0   Back to index