comparison 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
comparison
equal deleted inserted replaced
28054:8515b813976b 28055:92e8e3f20a6f
722 (br':%d\b' % (self._startport + 2), b':$HGPORT3'), 722 (br':%d\b' % (self._startport + 2), b':$HGPORT3'),
723 (br':%d\b' % (self._startport + 2), b':$HGPORT4'), 723 (br':%d\b' % (self._startport + 2), b':$HGPORT4'),
724 (br'(?m)^(saved backup bundle to .*\.hg)( \(glob\))?$', 724 (br'(?m)^(saved backup bundle to .*\.hg)( \(glob\))?$',
725 br'\1 (glob)'), 725 br'\1 (glob)'),
726 ] 726 ]
727 727 r.append((self._escapepath(self._testtmp), b'$TESTTMP'))
728
729 return r
730
731 def _escapepath(self, p):
728 if os.name == 'nt': 732 if os.name == 'nt':
729 r.append( 733 return (
730 (b''.join(c.isalpha() and b'[%s%s]' % (c.lower(), c.upper()) or 734 (b''.join(c.isalpha() and b'[%s%s]' % (c.lower(), c.upper()) or
731 c in b'/\\' and br'[/\\]' or c.isdigit() and c or b'\\' + c 735 c in b'/\\' and br'[/\\]' or c.isdigit() and c or b'\\' + c
732 for c in self._testtmp), b'$TESTTMP')) 736 for c in p))
737 )
733 else: 738 else:
734 r.append((re.escape(self._testtmp), b'$TESTTMP')) 739 return re.escape(p)
735
736 return r
737 740
738 def _getenv(self): 741 def _getenv(self):
739 """Obtain environment variables to use during test execution.""" 742 """Obtain environment variables to use during test execution."""
740 env = os.environ.copy() 743 env = os.environ.copy()
741 env['TESTTMP'] = self._testtmp 744 env['TESTTMP'] = self._testtmp