diff options
author | Ćukasz Langa <lukasz@langa.pl> | 2021-07-22 18:25:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-22 18:25:58 (GMT) |
commit | f1afef5e0d93d66fbf3c9aaeab8b3b8da9617583 (patch) | |
tree | 6f25fa40468d521378c9fa615360f2a6a2b593be /Lib/test/support | |
parent | 50ffbe3dafcae7826d114df61d56c7ac45a6358c (diff) | |
download | cpython-f1afef5e0d93d66fbf3c9aaeab8b3b8da9617583.zip cpython-f1afef5e0d93d66fbf3c9aaeab8b3b8da9617583.tar.gz cpython-f1afef5e0d93d66fbf3c9aaeab8b3b8da9617583.tar.bz2 |
bpo-44708: Only re-run test methods that match names of previously failing test methods (GH-27287)
* Move to a static argparse.Namespace subclass
* Roughly annotate runtest.py
* Refactor libregrtest to use lossless test result objects
* Only re-run test methods that match names of previously failing test methods
* Adopt tests to cover test method name matching
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 59b8f44..cbdc23c 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -105,6 +105,17 @@ class Error(Exception): class TestFailed(Error): """Test failed.""" +class TestFailedWithDetails(TestFailed): + """Test failed.""" + def __init__(self, msg, errors, failures): + self.msg = msg + self.errors = errors + self.failures = failures + super().__init__(msg, errors, failures) + + def __str__(self): + return self.msg + class TestDidNotRun(Error): """Test did not run any subtests.""" @@ -980,7 +991,9 @@ def _run_suite(suite): else: err = "multiple errors occurred" if not verbose: err += "; run in verbose mode for details" - raise TestFailed(err) + errors = [(str(tc), exc_str) for tc, exc_str in result.errors] + failures = [(str(tc), exc_str) for tc, exc_str in result.failures] + raise TestFailedWithDetails(err, errors, failures) # By default, don't filter tests |