diff tests/run-tests.py @ 28055:92e8e3f20a6f

run-tests: factor out _escapepath
author timeless <timeless@mozdev.org>
date Fri, 29 Jan 2016 14:35:34 +0000
parents 54c896f8bb79
children 62ef44273678
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."""