# HG changeset patch # User Adam Simpkins # Date 2017-06-29 18:29:19 # Node ID f458a6701983e7c8f50308d191bc8a6e3ee41873 # Parent 40ee74bfa11122a0a3ab74186f5056243b84af89 tests: fix variable name regular expression in _genrestoreenv() Update the code to correctly anchor the expression on the end of the name, to require that the entire name match this expression. It was already anchored at the start by using re.match(), but this does not anchor it at the end. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -905,7 +905,7 @@ class Test(unittest.TestCase): # Only restore environment variable names that the shell allows # us to export. - name_regex = re.compile('[a-zA-Z][a-zA-Z0-9_]*') + name_regex = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$') with open(scriptpath, 'w') as envf: for name, value in os.environ.items():