Mercurial > hg-stable
changeset 48877:9dad328434c7 stable
tests: work around non-thread-safeness of sysconfig.get_config_var()
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sun, 29 May 2022 14:44:19 +0200 |
parents | 9ea9445c3223 |
children | 201222849987 |
files | tests/run-tests.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Tue May 24 11:19:24 2022 +0200 +++ b/tests/run-tests.py Sun May 29 14:44:19 2022 +0200 @@ -1000,6 +1000,10 @@ return killmod.killdaemons(pidfile, tryhard=False, remove=True, logfn=vlog) +# sysconfig is not thread-safe (https://github.com/python/cpython/issues/92452) +sysconfiglock = threading.Lock() + + class Test(unittest.TestCase): """Encapsulates a single, runnable test. @@ -1430,7 +1434,8 @@ env["HGPORT%s" % offset] = '%s' % (self._startport + i) env = os.environ.copy() - env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or '' + with sysconfiglock: + env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or '' env['HGEMITWARNINGS'] = '1' env['TESTTMP'] = _bytes2sys(self._testtmp) # the FORWARD_SLASH version is useful when running `sh` on non unix