FIXUP: Fix linger tests

This commit is contained in:
Alex Pyrgiotis 2024-09-19 13:34:08 +03:00
parent 1472dca744
commit 66af7bce59
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
4 changed files with 11 additions and 12 deletions

View file

@ -336,7 +336,10 @@ class IsolationProvider(ABC):
document, p, timeout_grace=timeout_grace, timeout_force=timeout_force
)
if getattr(sys, "dangerzone_dev", False):
# Read the stderr of the process only if:
# * Dev mode is enabled.
# * The process has exited (else we risk hanging).
if getattr(sys, "dangerzone_dev", False) and p.poll() is not None:
assert p.stderr
debug_log = read_debug_text(p.stderr, MAX_CONVERSION_LOG_CHARS)
log.info(

View file

@ -1,13 +1,12 @@
import gzip
import json
import logging
import os
import platform
import shlex
import shutil
import signal
import subprocess
import sys
from typing import Any, List, Tuple
from typing import List, Tuple
from ..document import Document
from ..util import get_tmp_dir # NOQA : required for mocking in our tests.

View file

@ -1,15 +1,12 @@
import asyncio
import io
import logging
import os
import shutil
import subprocess
import sys
import zipfile
from pathlib import Path
from typing import IO, Optional
from typing import IO
from ..conversion import errors
from ..conversion.common import running_on_qubes
from ..document import Document
from ..util import get_resource_path

View file

@ -29,7 +29,7 @@ class IsolationProviderTest:
p = provider.start_doc_to_pixels_proc(doc)
with pytest.raises(errors.ConverterProcException):
provider.doc_to_pixels(doc, tmpdir, p)
provider._convert(doc, tmpdir, None, p)
assert provider.get_proc_exception(p) == errors.MaxPagesException
def test_max_pages_client_enforcement(
@ -46,7 +46,7 @@ class IsolationProviderTest:
doc = Document(sample_doc)
p = provider.start_doc_to_pixels_proc(doc)
with pytest.raises(errors.MaxPagesException):
provider.doc_to_pixels(doc, tmpdir, p)
provider._convert(doc, tmpdir, None, p)
def test_max_dimensions(
self,
@ -60,12 +60,12 @@ class IsolationProviderTest:
doc = Document(sample_bad_width)
p = provider.start_doc_to_pixels_proc(doc)
with pytest.raises(errors.MaxPageWidthException):
provider.doc_to_pixels(doc, tmpdir, p)
provider._convert(doc, tmpdir, None, p)
doc = Document(sample_bad_height)
p = provider.start_doc_to_pixels_proc(doc)
with pytest.raises(errors.MaxPageHeightException):
provider.doc_to_pixels(doc, tmpdir, p)
provider._convert(doc, tmpdir, None, p)
class IsolationProviderTermination: