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

David R. MacIver david at drmaciver.com
Wed Feb 17 11:38:04 UTC 2016


# 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")


More information about the Mercurial-devel mailing list