'Constructs a `TestRunner` to run in the given path, and returns a
``test()`` function which takes the same arguments as
`TestRunner.run_tests`.
The returned ``test()`` function will be defined in the module this
was called from.  This is used to implement the ``astropy.test()``
function (or the equivalent for affiliated packages).'

@classmethod
def make_test_runner_in(cls, path):

    runner = cls(path)
    @wraps(runner.run_tests, (u'__doc__',), exclude_args=(u'self',))
    def test(**kwargs):
        return runner.run_tests(**kwargs)
    module = find_current_module(2)
    if (module is not None):
        test.__module__ = module.__name__
    if hasattr(test, u'__wrapped__'):
        del test.__wrapped__
    return test
