tests/run-tests.py
changeset 33140 f458a6701983
parent 33126 98e2c78e309c
child 33203 cf826b9e9ea4
equal deleted inserted replaced
33139:40ee74bfa111 33140:f458a6701983
   903         scriptpath = os.path.join(self._threadtmp, b'restoreenv.sh')
   903         scriptpath = os.path.join(self._threadtmp, b'restoreenv.sh')
   904         testenv['HGTEST_RESTOREENV'] = scriptpath
   904         testenv['HGTEST_RESTOREENV'] = scriptpath
   905 
   905 
   906         # Only restore environment variable names that the shell allows
   906         # Only restore environment variable names that the shell allows
   907         # us to export.
   907         # us to export.
   908         name_regex = re.compile('[a-zA-Z][a-zA-Z0-9_]*')
   908         name_regex = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$')
   909 
   909 
   910         with open(scriptpath, 'w') as envf:
   910         with open(scriptpath, 'w') as envf:
   911             for name, value in os.environ.items():
   911             for name, value in os.environ.items():
   912                 if not name_regex.match(name):
   912                 if not name_regex.match(name):
   913                     # Skip environment variables with unusual names not
   913                     # Skip environment variables with unusual names not