changeset 33140:f458a6701983

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.
author Adam Simpkins <simpkins@fb.com>
date Thu, 29 Jun 2017 11:29:19 -0700
parents 40ee74bfa111
children 4f49810a1011
files tests/run-tests.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Thu Jun 29 15:21:52 2017 -0700
+++ b/tests/run-tests.py	Thu Jun 29 11:29:19 2017 -0700
@@ -905,7 +905,7 @@
 
         # 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():