diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-06-09 08:18:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-09 08:18:48 (GMT) |
commit | ef8320cf6f09b659c63bfb188bf45dbcae556762 (patch) | |
tree | 84d5b1e129e763daddc70a307524dc4fc6e55df1 /Lib/test/support | |
parent | 824f6879121413e09439fffef54580413e44bf46 (diff) | |
download | cpython-ef8320cf6f09b659c63bfb188bf45dbcae556762.zip cpython-ef8320cf6f09b659c63bfb188bf45dbcae556762.tar.gz cpython-ef8320cf6f09b659c63bfb188bf45dbcae556762.tar.bz2 |
bpo-30540: regrtest: add --matchfile option (#1909)
* Add a new option taking a filename to get a list of test names to
filter tests.
* support.match_tests becomes a list.
* Modify run_unittest() to accept to match the whole test identifier,
not just a part of a test identifier.
For example, the following command only runs test_default_timeout()
of the BarrierTests class of test_threading:
$ ./python -m test -v test_threading -m test.test_threading.BarrierTests.test_default_timeout
Remove also some empty lines from test_regrtest.py to make flake8
tool happy.
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index d8d599b..0a3d4d9 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1922,9 +1922,15 @@ def run_unittest(*classes): def case_pred(test): if match_tests is None: return True - for name in test.id().split("."): - if fnmatch.fnmatchcase(name, match_tests): + test_id = test.id() + + for match_test in match_tests: + if fnmatch.fnmatchcase(test_id, match_test): return True + + for name in test_id.split("."): + if fnmatch.fnmatchcase(name, match_test): + return True return False _filter_suite(suite, case_pred) _run_suite(suite) |