Skip to content

Commit

Permalink
FIXUP: rename get_doc_to_pixels_proc -> start_doc_to_pixels_proc
Browse files Browse the repository at this point in the history
  • Loading branch information
deeplow committed Dec 22, 2023
1 parent 8ab2abe commit c4db485
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dangerzone/isolation_provider/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __init__(self) -> None:
super().__init__()

@abstractmethod
def get_doc_to_pixels_proc(self) -> subprocess.Popen:
def start_doc_to_pixels_proc(self) -> subprocess.Popen:
pass

def _convert(
Expand All @@ -163,7 +163,7 @@ def _convert(

def doc_to_pixels(self, document: Document, tempdir: str) -> None:
with open(document.input_filename, "rb") as f:
self.proc = self.get_doc_to_pixels_proc()
self.proc = self.start_doc_to_pixels_proc()
try:
assert self.proc.stdin is not None
self.proc.stdin.write(f.read())
Expand Down
2 changes: 1 addition & 1 deletion dangerzone/isolation_provider/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def pixels_to_pdf(
)
shutil.move(container_output_filename, document.output_filename)

def get_doc_to_pixels_proc(self) -> subprocess.Popen:
def start_doc_to_pixels_proc(self) -> subprocess.Popen:
# Convert document to pixels
command = [
"/usr/bin/python3",
Expand Down
2 changes: 1 addition & 1 deletion dangerzone/isolation_provider/qubes.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def print_progress_wrapper(error: bool, text: str, percentage: float) -> None:
def get_max_parallel_conversions(self) -> int:
return 1

def get_doc_to_pixels_proc(self) -> subprocess.Popen:
def start_doc_to_pixels_proc(self) -> subprocess.Popen:
dev_mode = getattr(sys, "dangerzone_dev", False) == True
if dev_mode:
# Use dz.ConvertDev RPC call instead, if we are in development mode.
Expand Down
6 changes: 4 additions & 2 deletions tests/isolation_provider/test_qubes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_out_of_ram(
) -> None:
provider.progress_callback = mocker.MagicMock()

def get_doc_to_pixels_proc() -> subprocess.Popen:
def start_doc_to_pixels_proc() -> subprocess.Popen:
p = subprocess.Popen(
# XXX error 126 simulates a qrexec-policy failure. Source:
# https://github.com/QubesOS/qubes-core-qrexec/blob/fdcbfd7/daemon/qrexec-daemon.c#L1022
Expand All @@ -81,7 +81,9 @@ def get_doc_to_pixels_proc() -> subprocess.Popen:
)
return p

monkeypatch.setattr(provider, "get_doc_to_pixels_proc", get_doc_to_pixels_proc)
monkeypatch.setattr(
provider, "start_doc_to_pixels_proc", start_doc_to_pixels_proc
)

with pytest.raises(errors.QubesQrexecFailed) as e:
doc = Document(sample_doc)
Expand Down

0 comments on commit c4db485

Please sign in to comment.