##// END OF EJS Templates
test-run-tests: stabilize the test (issue5735)...
Jun Wu -
r35586:87676e8e stable
parent child Browse files
Show More
@@ -659,6 +659,7 b' class Test(unittest.TestCase):'
659 659
660 660 def __init__(self, path, outputdir, tmpdir, keeptmpdir=False,
661 661 debug=False,
662 first=False,
662 663 timeout=None,
663 664 startport=None, extraconfigopts=None,
664 665 py3kwarnings=False, shell=None, hgcommand=None,
@@ -711,6 +712,7 b' class Test(unittest.TestCase):'
711 712 self._threadtmp = tmpdir
712 713 self._keeptmpdir = keeptmpdir
713 714 self._debug = debug
715 self._first = first
714 716 self._timeout = timeout
715 717 self._slowtimeout = slowtimeout
716 718 self._startport = startport
@@ -896,9 +898,13 b' class Test(unittest.TestCase):'
896 898 f.close()
897 899
898 900 # The result object handles diff calculation for us.
901 with firstlock:
899 902 if self._result.addOutputMismatch(self, ret, out, self._refout):
900 903 # change was accepted, skip failing
901 904 return
905 if self._first:
906 global firsterror
907 firsterror = True
902 908
903 909 if ret:
904 910 msg = 'output changed and ' + describe(ret)
@@ -1620,6 +1626,8 b' class TTest(Test):'
1620 1626 return TTest.ESCAPESUB(TTest._escapef, s)
1621 1627
1622 1628 iolock = threading.RLock()
1629 firstlock = threading.RLock()
1630 firsterror = False
1623 1631
1624 1632 class TestResult(unittest._TextTestResult):
1625 1633 """Holds results when executing via unittest."""
@@ -1705,7 +1713,7 b' class TestResult(unittest._TextTestResul'
1705 1713
1706 1714 def addOutputMismatch(self, test, ret, got, expected):
1707 1715 """Record a mismatch in test output for a particular test."""
1708 if self.shouldStop:
1716 if self.shouldStop or firsterror:
1709 1717 # don't print, some other test case already failed and
1710 1718 # printed, we're just stale and probably failed due to our
1711 1719 # temp dir getting cleaned up.
@@ -2637,6 +2645,7 b' class TestRunner(object):'
2637 2645 t = testcls(refpath, self._outputdir, tmpdir,
2638 2646 keeptmpdir=self.options.keep_tmpdir,
2639 2647 debug=self.options.debug,
2648 first=self.options.first,
2640 2649 timeout=self.options.timeout,
2641 2650 startport=self._getport(count),
2642 2651 extraconfigopts=self.options.extra_config_opt,
General Comments 0
You need to be logged in to leave comments. Login now