changeset 21009:990f5392c018

run-tests: allow test paths in other directories Previously, test paths were assumed to be in the same directory and wouldn't have a directory component. If a path with a directory component was specified, it would be filtered out. This change allow paths to contain directories. This in turn allows tests from other directories to be executed. Executing tests in other directories may break assumptions elsewhere in the testing code. However, on initial glance, things appear to "just work." This approach of running tests from other directories is successfully being used at https://hg.mozilla.org/hgcustom/version-control-tools/file/7085790ff3af/run-mercurial-tests.py
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 24 Mar 2014 22:12:37 -0700
parents c1dd04be3d9a
children 3d4b54a6f346
files tests/run-tests.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Mon Mar 24 21:52:28 2014 -0700
+++ b/tests/run-tests.py	Mon Mar 24 22:12:37 2014 -0700
@@ -939,7 +939,7 @@
                 else:
                     return ignore("doesn't match keyword")
 
-    if not lctest.startswith("test-"):
+    if not os.path.basename(lctest).startswith("test-"):
         return skip("not a test file")
     for ext, func, out in testtypes:
         if lctest.endswith(ext):
@@ -1197,8 +1197,8 @@
             args = os.listdir(".")
 
     tests = [t for t in args
-             if t.startswith("test-")
-             and (t.endswith(".py") or t.endswith(".t"))]
+             if os.path.basename(t).startswith("test-")
+                 and (t.endswith(".py") or t.endswith(".t"))]
 
     if options.random:
         random.shuffle(tests)