[PATCH] tests: add support for listing tests to run in a file
Augie Fackler
raf at durin42.com
Mon Sep 18 21:24:48 UTC 2017
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1505769092 14400
# Mon Sep 18 17:11:32 2017 -0400
# Node ID aed354e1839520ab9a170cf63253ee8629c88afc
# Parent 84c98d179e5c2e902cd80fe3def3b73e6a8173f8
tests: add support for listing tests to run in a file
This will make it easier for us to run the tests in the python3
whitelist in buildbot.
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -303,6 +303,8 @@ def getparser():
help="skip tests listed in the specified blacklist file")
parser.add_option("--whitelist", action="append",
help="always run tests listed in the specified whitelist file")
+ parser.add_option("--test-list", action="append",
+ help="read tests to run from the specified file")
parser.add_option("--changed", type="string",
help="run tests that are changed in parent rev or working directory")
parser.add_option("-C", "--annotate", action="store_true",
@@ -2279,6 +2281,10 @@ class TestRunner(object):
# positional arguments are paths to test files to run, so
# we make sure they're all bytestrings
args = [_bytespath(a) for a in args]
+ if options.test_list is not None:
+ for listfile in options.test_list:
+ with open(listfile, 'rb') as f:
+ args.extend(t for t in f.read().splitlines() if t)
self.options = options
self._checktools()
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -981,6 +981,19 @@ Whitelist trumps blacklist
python hash seed: * (glob)
[1]
+Ensure that --test-list causes only the tests listed in that file to
+be executed.
+ $ echo test-success.t >> onlytest
+ $ rt --test-list=onlytest
+ .
+ # Ran 1 tests, 0 skipped, 0 failed.
+ $ echo test-bogus.t >> anothertest
+ $ rt --test-list=onlytest --test-list=anothertest
+ s.
+ Skipped test-bogus.t: Doesn't exist
+ # Ran 1 tests, 1 skipped, 0 failed.
+ $ rm onlytest anothertest
+
test for --json
==================
More information about the Mercurial-devel
mailing list