summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest/main.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-10-21 14:44:46 (GMT)
committerGitHub <noreply@github.com>2023-10-21 14:44:46 (GMT)
commit9a1fe09622cd0f1e24c2ba5335c94c5d70306fd0 (patch)
treedbe875ddc77513b66d98d172a02dd81783132b37 /Lib/test/libregrtest/main.py
parentb578e51f026a45576930816d6784697192ed472e (diff)
downloadcpython-9a1fe09622cd0f1e24c2ba5335c94c5d70306fd0.zip
cpython-9a1fe09622cd0f1e24c2ba5335c94c5d70306fd0.tar.gz
cpython-9a1fe09622cd0f1e24c2ba5335c94c5d70306fd0.tar.bz2
gh-110918: regrtest: allow to intermix --match and --ignore options (GH-110919)
Test case matching patterns specified by options --match, --ignore, --matchfile and --ignorefile are now tested in the order of specification, and the last match determines whether the test case be run or ignored.
Diffstat (limited to 'Lib/test/libregrtest/main.py')
-rw-r--r--Lib/test/libregrtest/main.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 02f3f84..9b86548 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -19,7 +19,7 @@ from .runtests import RunTests, HuntRefleak
from .setup import setup_process, setup_test_dir
from .single import run_single_test, PROGRESS_MIN_TIME
from .utils import (
- StrPath, StrJSON, TestName, TestList, TestTuple, FilterTuple,
+ StrPath, StrJSON, TestName, TestList, TestTuple, TestFilter,
strip_py_suffix, count, format_duration,
printlist, get_temp_dir, get_work_dir, exit_timeout,
display_header, cleanup_temp_dir, print_warning,
@@ -78,14 +78,7 @@ class Regrtest:
and ns._add_python_opts)
# Select tests
- if ns.match_tests:
- self.match_tests: FilterTuple | None = tuple(ns.match_tests)
- else:
- self.match_tests = None
- if ns.ignore_tests:
- self.ignore_tests: FilterTuple | None = tuple(ns.ignore_tests)
- else:
- self.ignore_tests = None
+ self.match_tests: TestFilter = ns.match_tests
self.exclude: bool = ns.exclude
self.fromfile: StrPath | None = ns.fromfile
self.starting_test: TestName | None = ns.start
@@ -389,7 +382,7 @@ class Regrtest:
def display_summary(self):
duration = time.perf_counter() - self.logger.start_time
- filtered = bool(self.match_tests) or bool(self.ignore_tests)
+ filtered = bool(self.match_tests)
# Total duration
print()
@@ -407,7 +400,6 @@ class Regrtest:
fail_fast=self.fail_fast,
fail_env_changed=self.fail_env_changed,
match_tests=self.match_tests,
- ignore_tests=self.ignore_tests,
match_tests_dict=None,
rerun=False,
forever=self.forever,
@@ -660,7 +652,6 @@ class Regrtest:
elif self.want_list_cases:
list_cases(selected,
match_tests=self.match_tests,
- ignore_tests=self.ignore_tests,
test_dir=self.test_dir)
else:
exitcode = self.run_tests(selected, tests)