From cfb5e75be956ffc35ea67c979d69c0c93265bbb4 Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Thu, 25 Jul 2024 12:44:54 +0300 Subject: [PATCH] tests: Do not let LibreOffice hang on the large test set Some of the files in our large test set can make LibreOffice hang. We do not have a proper solution for this yet, but we can at least make the tests timeout quickly, so that they can finish at some point. Refs #878 --- tests/test_large_set.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_large_set.py b/tests/test_large_set.py index 6365dec1a..42a5ecdec 100644 --- a/tests/test_large_set.py +++ b/tests/test_large_set.py @@ -75,7 +75,12 @@ def run_doc_test(self, doc: Path, tmp_path: Path) -> None: stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) - out, _ = p.communicate() + try: + # Set a global timeout of 5 minutes for the processing of a document. + # This is hacky way to sidestep https://github.com/freedomofpress/dangerzone/issues/878 + out, _ = p.communicate(timeout=5 * 60) + except subprocess.TimeoutExpired: + print(f"*** TIMEOUT EXCEEDED FOR DOCUMENT '{doc}' ***") from strip_ansi import strip_ansi print(strip_ansi(out.decode()))