From 59086253df93ec90b1f0013b3e56628553d33558 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..7bc8bcb08 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 30 minutes for the processing of a document. + # This is necessary due to https://github.com/freedomofpress/dangerzone/issues/878 + out, _ = p.communicate(timeout=30 * 60) + except subprocess.TimeoutExpired: + print(f"*** TIMEOUT EXCEEDED FOR DOCUMENT '{doc}' ***") from strip_ansi import strip_ansi print(strip_ansi(out.decode()))