Show More
@@ -543,14 +543,13 b' class Test(unittest.TestCase):' | |||
|
543 | 543 | |
|
544 | 544 | This will return a tuple describing the result of the test. |
|
545 | 545 | """ |
|
546 | replacements = self._getreplacements() | |
|
547 | 546 | env = self._getenv() |
|
548 | 547 | self._daemonpids.append(env['DAEMON_PIDS']) |
|
549 | 548 | self._createhgrc(env['HGRCPATH']) |
|
550 | 549 | |
|
551 | 550 | vlog('# Test', self.name) |
|
552 | 551 | |
|
553 |
ret, out = self._run( |
|
|
552 | ret, out = self._run(env) | |
|
554 | 553 | self._finished = True |
|
555 | 554 | self._ret = ret |
|
556 | 555 | self._out = out |
@@ -623,7 +622,7 b' class Test(unittest.TestCase):' | |||
|
623 | 622 | |
|
624 | 623 | vlog("# Ret was:", self._ret) |
|
625 | 624 | |
|
626 |
def _run(self, |
|
|
625 | def _run(self, env): | |
|
627 | 626 | # This should be implemented in child classes to run tests. |
|
628 | 627 | raise SkipTest('unknown test type') |
|
629 | 628 | |
@@ -722,7 +721,7 b' class Test(unittest.TestCase):' | |||
|
722 | 721 | # Failed is denoted by AssertionError (by default at least). |
|
723 | 722 | raise AssertionError(msg) |
|
724 | 723 | |
|
725 |
def _runcommand(self, cmd, |
|
|
724 | def _runcommand(self, cmd, env, normalizenewlines=False): | |
|
726 | 725 | """Run command in a sub-process, capturing the output (stdout and |
|
727 | 726 | stderr). |
|
728 | 727 | |
@@ -763,7 +762,7 b' class Test(unittest.TestCase):' | |||
|
763 | 762 | if ret: |
|
764 | 763 | killdaemons(env['DAEMON_PIDS']) |
|
765 | 764 | |
|
766 | for s, r in replacements: | |
|
765 | for s, r in self._getreplacements(): | |
|
767 | 766 | output = re.sub(s, r, output) |
|
768 | 767 | |
|
769 | 768 | if normalizenewlines: |
@@ -778,12 +777,12 b' class PythonTest(Test):' | |||
|
778 | 777 | def refpath(self): |
|
779 | 778 | return os.path.join(self._testdir, '%s.out' % self.name) |
|
780 | 779 | |
|
781 |
def _run(self, |
|
|
780 | def _run(self, env): | |
|
782 | 781 | py3kswitch = self._py3kwarnings and ' -3' or '' |
|
783 | 782 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self.path) |
|
784 | 783 | vlog("# Running", cmd) |
|
785 | 784 | normalizenewlines = os.name == 'nt' |
|
786 |
result = self._runcommand(cmd, |
|
|
785 | result = self._runcommand(cmd, env, | |
|
787 | 786 | normalizenewlines=normalizenewlines) |
|
788 | 787 | if self._aborted: |
|
789 | 788 | raise KeyboardInterrupt() |
@@ -814,7 +813,7 b' class TTest(Test):' | |||
|
814 | 813 | def refpath(self): |
|
815 | 814 | return os.path.join(self._testdir, self.name) |
|
816 | 815 | |
|
817 |
def _run(self, |
|
|
816 | def _run(self, env): | |
|
818 | 817 | f = open(self.path, 'rb') |
|
819 | 818 | lines = f.readlines() |
|
820 | 819 | f.close() |
@@ -831,7 +830,7 b' class TTest(Test):' | |||
|
831 | 830 | cmd = '%s "%s"' % (self._shell, fname) |
|
832 | 831 | vlog("# Running", cmd) |
|
833 | 832 | |
|
834 |
exitcode, output = self._runcommand(cmd, |
|
|
833 | exitcode, output = self._runcommand(cmd, env) | |
|
835 | 834 | |
|
836 | 835 | if self._aborted: |
|
837 | 836 | raise KeyboardInterrupt() |
General Comments 0
You need to be logged in to leave comments.
Login now