Submitter | Gregory Szorc |
---|---|
Date | March 25, 2014, 5:12 a.m. |
Message ID | <30d0d63c248995f9e981.1395724376@77.1.168.192.in-addr.arpa> |
Download | mbox | patch |
Permalink | /patch/4059/ |
State | Accepted |
Commit | 9ce75a5990b3e18bef7ae2a10f90698c4b68abba |
Headers | show |
Comments
On Mon, Mar 24, 2014 at 10:12:56PM -0700, Gregory Szorc wrote: > # HG changeset patch > # User Gregory Szorc <gregory.szorc@gmail.com> > # Date 1395724357 25200 > # Mon Mar 24 22:12:37 2014 -0700 > # Node ID 30d0d63c248995f9e981e25389d2e79bf7e5f96c > # Parent 9d7b3768e916df9eb4acbbbce6cb55b63f152b59 > run-tests: allow test paths in other directories These all look good to me (especially as an external extension author). Queued. > > 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 > > diff --git a/tests/run-tests.py b/tests/run-tests.py > --- a/tests/run-tests.py > +++ b/tests/run-tests.py > @@ -934,17 +934,17 @@ def runone(options, test, count): > t = fp.read().lower() + test.lower() > fp.close() > for k in options.keywords.lower().split(): > if k in t: > break > 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): > runner = func > ref = os.path.join(TESTDIR, test + out) > break > else: > return skip("unknown test type") > @@ -1192,18 +1192,18 @@ def main(args, parser=None): > proc = Popen4('hg st --rev "%s" -man0 .' % options.changed, > None, 0) > stdout, stderr = proc.communicate() > args = stdout.strip('\0').split('\0') > else: > 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) > else: > # keywords for slow tests > slow = 'svn gendoc check-code-hg'.split() > def sortkey(f): > # run largest tests first, as they tend to take the longest > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -934,17 +934,17 @@ def runone(options, test, count): t = fp.read().lower() + test.lower() fp.close() for k in options.keywords.lower().split(): if k in t: break 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): runner = func ref = os.path.join(TESTDIR, test + out) break else: return skip("unknown test type") @@ -1192,18 +1192,18 @@ def main(args, parser=None): proc = Popen4('hg st --rev "%s" -man0 .' % options.changed, None, 0) stdout, stderr = proc.communicate() args = stdout.strip('\0').split('\0') else: 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) else: # keywords for slow tests slow = 'svn gendoc check-code-hg'.split() def sortkey(f): # run largest tests first, as they tend to take the longest