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

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 24, 2019, 7:42 p.m.
Message ID <8cdce8eb1864523086cb.1551037364@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/38909/
State Accepted
Headers show

Comments

Pierre-Yves David - Feb. 24, 2019, 7:42 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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 = []