[PATCH 5 of 8 "STABLE] runtest: extract the logic that update timeout for slow tests

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Feb 24 14:42:44 EST 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1551034594 -3600
#      Sun Feb 24 19:56:34 2019 +0100
# Branch stable
# Node ID 8cdce8eb1864523086cb3ddc686c1244db421910
# Parent  e1e189e4b1780a87c28fd712d598ab6ee6ad3811
# EXP-Topic test-sparse-revlog
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8cdce8eb1864
runtest: extract the logic that update timeout for slow tests

We want to use the "slow" test logic not only for "#require" clauses but also in
"#if" clauses. For this to be useful we need the logic to bump the timeout in at
least two spots. The first step it to factor it out.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1375,12 +1375,16 @@ class TTest(Test):
             self._have[allreqs] = (False, stdout)
             return False, stdout
 
-        if b'slow' in reqs:
-            self._timeout = self._slowtimeout
+        self._detectslow(reqs)
 
         self._have[allreqs] = (True, None)
         return True, None
 
+    def _detectslow(self, reqs):
+        """update the timeout of slow test when appropriate"""
+        if b'slow' in reqs:
+            self._timeout = self._slowtimeout
+
     def _iftest(self, args):
         # implements "#if"
         reqs = []


More information about the Mercurial-devel mailing list