##// END OF EJS Templates
tests: work around non-thread-safeness of sysconfig.get_config_var()
Manuel Jacob -
r50129:9dad3284 stable
parent child Browse files
Show More
@@ -1000,6 +1000,10 b' def killdaemons(pidfile):'
1000 return killmod.killdaemons(pidfile, tryhard=False, remove=True, logfn=vlog)
1000 return killmod.killdaemons(pidfile, tryhard=False, remove=True, logfn=vlog)
1001
1001
1002
1002
1003 # sysconfig is not thread-safe (https://github.com/python/cpython/issues/92452)
1004 sysconfiglock = threading.Lock()
1005
1006
1003 class Test(unittest.TestCase):
1007 class Test(unittest.TestCase):
1004 """Encapsulates a single, runnable test.
1008 """Encapsulates a single, runnable test.
1005
1009
@@ -1430,6 +1434,7 b' class Test(unittest.TestCase):'
1430 env["HGPORT%s" % offset] = '%s' % (self._startport + i)
1434 env["HGPORT%s" % offset] = '%s' % (self._startport + i)
1431
1435
1432 env = os.environ.copy()
1436 env = os.environ.copy()
1437 with sysconfiglock:
1433 env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
1438 env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
1434 env['HGEMITWARNINGS'] = '1'
1439 env['HGEMITWARNINGS'] = '1'
1435 env['TESTTMP'] = _bytes2sys(self._testtmp)
1440 env['TESTTMP'] = _bytes2sys(self._testtmp)
General Comments 0
You need to be logged in to leave comments. Login now