[PATCH 1 of 2] run-tests: factor out _escapepath

timeless timeless at mozdev.org
Tue Feb 9 20:28:51 UTC 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1454078134 0
#      Fri Jan 29 14:35:34 2016 +0000
# Node ID 9f2904cf536b2262f9e5b50d9bb6cf35c701f880
# Parent  a036e1ae1fbe88ab99cb861ebfc2e4da7a3912ca
run-tests: factor out _escapepath

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -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."""


More information about the Mercurial-devel mailing list