##// END OF EJS Templates
run-tests: separate newline normalization from replacements...
Gregory Szorc -
r24510:8d6fd0b8 default
parent child Browse files
Show More
@@ -722,7 +722,7 b' class Test(unittest.TestCase):'
722 # Failed is denoted by AssertionError (by default at least).
722 # Failed is denoted by AssertionError (by default at least).
723 raise AssertionError(msg)
723 raise AssertionError(msg)
724
724
725 def _runcommand(self, cmd, replacements, env):
725 def _runcommand(self, cmd, replacements, env, normalizenewlines=False):
726 """Run command in a sub-process, capturing the output (stdout and
726 """Run command in a sub-process, capturing the output (stdout and
727 stderr).
727 stderr).
728
728
@@ -765,6 +765,10 b' class Test(unittest.TestCase):'
765
765
766 for s, r in replacements:
766 for s, r in replacements:
767 output = re.sub(s, r, output)
767 output = re.sub(s, r, output)
768
769 if normalizenewlines:
770 output = output.replace('\r\n', '\n')
771
768 return ret, output.splitlines(True)
772 return ret, output.splitlines(True)
769
773
770 class PythonTest(Test):
774 class PythonTest(Test):
@@ -778,9 +782,9 b' class PythonTest(Test):'
778 py3kswitch = self._py3kwarnings and ' -3' or ''
782 py3kswitch = self._py3kwarnings and ' -3' or ''
779 cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self.path)
783 cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self.path)
780 vlog("# Running", cmd)
784 vlog("# Running", cmd)
781 if os.name == 'nt':
785 normalizenewlines = os.name == 'nt'
782 replacements.append((r'\r\n', '\n'))
786 result = self._runcommand(cmd, replacements, env,
783 result = self._runcommand(cmd, replacements, env)
787 normalizenewlines=normalizenewlines)
784 if self._aborted:
788 if self._aborted:
785 raise KeyboardInterrupt()
789 raise KeyboardInterrupt()
786
790
General Comments 0
You need to be logged in to leave comments. Login now