diff --git a/dangerzone/gui/main_window.py b/dangerzone/gui/main_window.py index e292ff0..788ad6a 100644 --- a/dangerzone/gui/main_window.py +++ b/dangerzone/gui/main_window.py @@ -500,6 +500,7 @@ class WaitingWidgetContainer(WaitingWidget): 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)) diff --git a/dangerzone/isolation_provider/base.py b/dangerzone/isolation_provider/base.py index 6a55a20..9404cee 100644 --- a/dangerzone/isolation_provider/base.py +++ b/dangerzone/isolation_provider/base.py @@ -93,10 +93,6 @@ class IsolationProvider(ABC): else: self.proc_stderr = subprocess.DEVNULL - @staticmethod - def is_runtime_available() -> bool: - return True - @abstractmethod def install(self) -> bool: pass diff --git a/dangerzone/isolation_provider/dummy.py b/dangerzone/isolation_provider/dummy.py index 9ebc345..b8e3b87 100644 --- a/dangerzone/isolation_provider/dummy.py +++ b/dangerzone/isolation_provider/dummy.py @@ -39,6 +39,10 @@ class Dummy(IsolationProvider): 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, diff --git a/tests/gui/test_main_window.py b/tests/gui/test_main_window.py index ff45075..7e96d22 100644 --- a/tests/gui/test_main_window.py +++ b/tests/gui/test_main_window.py @@ -30,6 +30,7 @@ from dangerzone.isolation_provider.container import ( NoContainerTechException, NotAvailableContainerTechException, ) +from dangerzone.isolation_provider.dummy import Dummy from .test_updater import assert_report_equal, default_updater_settings @@ -510,9 +511,9 @@ def test_not_available_container_tech_exception( ) -> None: # Setup mock_app = mocker.MagicMock() - dummy = mocker.MagicMock() - - dummy.is_runtime_available.side_effect = NotAvailableContainerTechException( + dummy = Dummy() + fn = mocker.patch.object(dummy, "is_runtime_available") + fn.side_effect = NotAvailableContainerTechException( "podman", "podman image ls logs" )