[PATCH] run-tests: allow run-tests.py to run tests outside current directory

David MacIver david at drmaciver.com
Thu Feb 18 03:59:56 EST 2016


Certainly. Done and sent.

The comment at the top of run-tests.py suggested that testing of it was
manual, which is why I didn't think to look for similar tests. Would you be
amenable to a second patch to amend the comment?

On 17 February 2016 at 19:59, timeless <timeless at gmail.com> wrote:

> Please provide a test.
> Basically, your test should generate such a directory+test file and
> call run-tests (with --local) with it.
>
> On Wed, Feb 17, 2016 at 6:38 AM, David R. MacIver <david at drmaciver.com>
> wrote:
> > # HG changeset patch
> > # User David R. MacIver <david at drmaciver.com>
> > # Date 1455708193 0
> > #      Wed Feb 17 11:23:13 2016 +0000
> > # Branch all
> > # Node ID 29fd0a20bb724be92c2bcc6a5fa71eaca290c158
> > # Parent  a036e1ae1fbe88ab99cb861ebfc2e4da7a3912ca
> > run-tests: allow run-tests.py to run tests outside current directory
> >
> > When reloading tests, run-tests.py was assuming that it could look
> > up the test by the basename, which only works if you are running
> > tests which are in the current directory.
> >
> > This patch changes that lookup to use the full path. This is all
> > that was needed, and does not appear to cause any problems for
> > any of the existing testing work flows based on running the
> > suggested commands at the top of run-tests.py.
> >
> > Motivation: In order to test Mercurial with Hypothesis (according
> > to https://www.mercurial-scm.org/wiki/HypothesisPlan) it is
> > useful to be able to generate temporary test files and execute
> > them. Generating temporary files in the tests/ directory leads to
> > a lot of suboptimal clutter.
> >
> > diff -r a036e1ae1fbe -r 29fd0a20bb72 tests/run-tests.py
> > --- a/tests/run-tests.py        Sun Feb 07 00:49:31 2016 -0600
> > +++ b/tests/run-tests.py        Wed Feb 17 11:23:13 2016 +0000
> > @@ -1485,7 +1485,7 @@
> >              def get():
> >                  num_tests[0] += 1
> >                  if getattr(test, 'should_reload', False):
> > -                    return self._loadtest(test.bname, num_tests[0])
> > +                    return self._loadtest(test.path, num_tests[0])
> >                  return test
> >              if not os.path.exists(test.path):
> >                  result.addSkip(test, "Doesn't exist")
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160218/04c79d4e/attachment.html>


More information about the Mercurial-devel mailing list