def METHOD_NAME():
    """
    Encapsulates the StubRunner in a context manager so its run function is called
    when the context is exited.
    """
    @contextlib.contextmanager
    def _runner(err, stop):
        runner = StubRunner(err, stop)
        yield runner
        runner.run()
    return _runner