comparison tests/run-tests.py @ 48273: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
comparison
equal deleted inserted replaced
48272:f6b045910d82 48273:3a95a4e660b9
2231 2231
2232 iolock = threading.RLock() 2232 iolock = threading.RLock()
2233 firstlock = threading.RLock() 2233 firstlock = threading.RLock()
2234 firsterror = False 2234 firsterror = False
2235 2235
2236 2236 if PYTHON3:
2237 class TestResult(unittest._TextTestResult): 2237 base_class = unittest.TextTestResult
2238 else:
2239 base_class = unittest._TextTestResult
2240
2241
2242 class TestResult(base_class):
2238 """Holds results when executing via unittest.""" 2243 """Holds results when executing via unittest."""
2239 2244
2240 # Don't worry too much about accessing the non-public _TextTestResult.
2241 # It is relatively common in Python testing tools.
2242 def __init__(self, options, *args, **kwargs): 2245 def __init__(self, options, *args, **kwargs):
2243 super(TestResult, self).__init__(*args, **kwargs) 2246 super(TestResult, self).__init__(*args, **kwargs)
2244 2247
2245 self._options = options 2248 self._options = options
2246 2249