changeset 28055:92e8e3f20a6f

run-tests: factor out _escapepath
author timeless <timeless@mozdev.org>
date Fri, 29 Jan 2016 14:35:34 +0000
parents 8515b813976b
children ff6e8dc659f8
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Mon Feb 08 12:33:00 2016 -0500
+++ b/tests/run-tests.py	Fri Jan 29 14:35:34 2016 +0000
@@ -724,16 +724,19 @@
             (br'(?m)^(saved backup bundle to .*\.hg)( \(glob\))?$',
              br'\1 (glob)'),
             ]
+        r.append((self._escapepath(self._testtmp), b'$TESTTMP'))
 
+        return r
+
+    def _escapepath(self, p):
         if os.name == 'nt':
-            r.append(
+            return (
                 (b''.join(c.isalpha() and b'[%s%s]' % (c.lower(), c.upper()) or
                     c in b'/\\' and br'[/\\]' or c.isdigit() and c or b'\\' + c
-                    for c in self._testtmp), b'$TESTTMP'))
+                    for c in p))
+            )
         else:
-            r.append((re.escape(self._testtmp), b'$TESTTMP'))
-
-        return r
+            return re.escape(p)
 
     def _getenv(self):
         """Obtain environment variables to use during test execution."""