Skip to content

Commit

Permalink
Move container-specific method from base class
Browse files Browse the repository at this point in the history
Move the `is_runtime_available()` method from the base
`IsolationProvider` class, and into the `Dummy` provider class. This
method was originally defined in the base class, in order to be mocked
in our tests for the `Dummy` provider. There's no reason for the `Qubes`
class to have it though, so we can just move it to the `Dummy` provider.
  • Loading branch information
apyrgio committed Dec 2, 2024
1 parent fdc27c4 commit b542668
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ def check_state(self) -> None:
error: Optional[str] = None

try:
assert isinstance(self.dangerzone.isolation_provider, (Dummy, Container))
self.dangerzone.isolation_provider.is_runtime_available()
except NoContainerTechException as e:
log.error(str(e))
Expand Down
4 changes: 0 additions & 4 deletions dangerzone/isolation_provider/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ def __init__(self) -> None:
else:
self.proc_stderr = subprocess.DEVNULL

@staticmethod
def is_runtime_available() -> bool:
return True

@abstractmethod
def install(self) -> bool:
pass
Expand Down
4 changes: 4 additions & 0 deletions dangerzone/isolation_provider/dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def __init__(self) -> None:
def install(self) -> bool:
return True

@staticmethod
def is_runtime_available() -> bool:
return True

def start_doc_to_pixels_proc(self, document: Document) -> subprocess.Popen:
cmd = [
sys.executable,
Expand Down

0 comments on commit b542668

Please sign in to comment.