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
This commit is contained in:
Alex Pyrgiotis 2024-07-25 12:44:54 +03:00
parent 3f86e7b465
commit cfb5e75be9
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -75,7 +75,12 @@ class TestLargeSet(TestCli):
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, 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 from strip_ansi import strip_ansi
print(strip_ansi(out.decode())) print(strip_ansi(out.decode()))