'test_path : str, optional
Specify location to test by path. May be a single file or
directory. Must be specified absolutely or relative to the
calling directory.'

@keyword()
def test_path(self, test_path, kwargs):

    all_args = []
    self.package(kwargs[u'package'], kwargs)
    if test_path:
        (base, ext) = os.path.splitext(test_path)
        if (ext in (u'.rst', u'')):
            if (kwargs[u'docs_path'] is None):
                raise ValueError(u'Can    not    test    .rst    files    without    a    docs_path    specified.')
            abs_docs_path = os.path.abspath(kwargs[u'docs_path'])
            abs_test_path = os.path.abspath(os.path.join(abs_docs_path, os.pardir, test_path))
            common = os.path.commonprefix((abs_docs_path, abs_test_path))
            if (os.path.exists(abs_test_path) and (common == abs_docs_path)):
                all_args.extend([u'-p', u'astropy.tests.pytest_plugins', u'--doctest-rst'])
                test_path = abs_test_path
        if (not (os.path.isdir(test_path) or (ext in (u'.py', u'.rst')))):
            raise ValueError(u'Test    path    must    be    a    directory    or    a    path    to    a    .py    or    .rst    file')
        return (all_args + [test_path])
    return []
