diff --git a/zerver/lib/timeout.py b/zerver/lib/timeout.py index 591e07c52a..6495719ab4 100644 --- a/zerver/lib/timeout.py +++ b/zerver/lib/timeout.py @@ -84,9 +84,9 @@ def timeout(timeout: float, func: Callable[[], ResultT]) -> ResultT: # kill it), just raise from here; the thread _may still be # running_ because it failed to see any of our exceptions, and # we just ignore it. - if thread.is_alive(): + if thread.is_alive(): # nocoverage logging.warning("Failed to time out backend thread") - raise TimeoutExpiredError + raise TimeoutExpiredError # nocoverage if thread.exc_info[1] is not None: # Died with some other exception; re-raise it diff --git a/zerver/tests/test_timeout.py b/zerver/tests/test_timeout.py index fe2eac8f1d..945aa37a98 100644 --- a/zerver/tests/test_timeout.py +++ b/zerver/tests/test_timeout.py @@ -1,5 +1,7 @@ +import sys import time import traceback +from unittest import skipIf from zerver.lib.test_classes import ZulipTestCase from zerver.lib.timeout import TimeoutExpiredError, timeout @@ -39,6 +41,7 @@ class TimeoutTestCase(ZulipTestCase): self.assertIn("in something_exceptional", tb[-1]) self.assertIn("raise ValueError", tb[-1]) + @skipIf(sys.version_info >= (3, 11), "https://github.com/nedbat/coveragepy/issues/1626") def test_timeout_warn(self) -> None: # If the sleep is long enough, it will outlast the attempts to # kill it