testing: fix _timeout_factor
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 02 Jul 2021 20:18:42 +0200
changeset 47493 2dac94edd98d
parent 47492 f03e9d30258e
child 47494 81d70de39c7e
testing: fix _timeout_factor With `--debug`, `run-tests.py` set the timeout to 0... that breaks the logic in `mercurial.testing`. Differential Revision: https://phab.mercurial-scm.org/D10937
mercurial/testing/__init__.py
--- a/mercurial/testing/__init__.py	Sat Jul 03 10:21:16 2021 +0300
+++ b/mercurial/testing/__init__.py	Fri Jul 02 20:18:42 2021 +0200
@@ -16,8 +16,10 @@
 
 def _timeout_factor():
     """return the current modification to timeout"""
-    default = int(environ.get('HGTEST_TIMEOUT_DEFAULT', 1))
+    default = int(environ.get('HGTEST_TIMEOUT_DEFAULT', 360))
     current = int(environ.get('HGTEST_TIMEOUT', default))
+    if current == 0:
+        return 1
     return current / float(default)