Mercurial > public > mercurial-scm > hg-stable
diff tests/run-tests.py @ 47898:3a95a4e660b9 stable
python: compatibility for python 3.11 (issue6604)
The `unittest._TextTestResult` alias has been removed.
The "new" name has been available since 3.2, and we only support 3.5.3+.
Differential Revision: https://phab.mercurial-scm.org/D11690
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Tue, 19 Oct 2021 16:05:20 +0200 |
parents | d3f890e04525 |
children | 96aa3a68d3b5 |
line wrap: on
line diff
--- a/tests/run-tests.py Wed Oct 20 16:54:43 2021 +0200 +++ b/tests/run-tests.py Tue Oct 19 16:05:20 2021 +0200 @@ -2233,12 +2233,15 @@ firstlock = threading.RLock() firsterror = False - -class TestResult(unittest._TextTestResult): +if PYTHON3: + base_class = unittest.TextTestResult +else: + base_class = unittest._TextTestResult + + +class TestResult(base_class): """Holds results when executing via unittest.""" - # Don't worry too much about accessing the non-public _TextTestResult. - # It is relatively common in Python testing tools. def __init__(self, options, *args, **kwargs): super(TestResult, self).__init__(*args, **kwargs)