diff --git a/src/webdrop_bridge/ui/main_window.py b/src/webdrop_bridge/ui/main_window.py index 3de11da..cf51394 100644 --- a/src/webdrop_bridge/ui/main_window.py +++ b/src/webdrop_bridge/ui/main_window.py @@ -5,7 +5,7 @@ import logging from pathlib import Path from typing import Optional -from PySide6.QtCore import QSize, Qt, QThread, QUrl, Signal +from PySide6.QtCore import QObject, QSize, Qt, QThread, QUrl, Signal from PySide6.QtWidgets import QLabel, QMainWindow, QStatusBar, QToolBar, QVBoxLayout, QWidget from webdrop_bridge.config import Config @@ -657,9 +657,14 @@ class MainWindow(QMainWindow): logger.error("Failed to launch update installer") -class UpdateCheckWorker: +class UpdateCheckWorker(QObject): """Worker for running update check asynchronously.""" + # Define signals at class level + update_available = Signal(object) # Emits Release object + update_status = Signal(str, str) # Emits (status_text, emoji) + finished = Signal() + def __init__(self, manager, current_version: str): """Initialize worker. @@ -667,14 +672,9 @@ class UpdateCheckWorker: manager: UpdateManager instance current_version: Current app version """ + super().__init__() self.manager = manager self.current_version = current_version - - # Create signals - from PySide6.QtCore import Signal - self.update_available = Signal(object) - self.update_status = Signal(str, str) - self.finished = Signal() def run(self) -> None: """Run the update check.""" diff --git a/tests/integration/test_update_flow.py b/tests/integration/test_update_flow.py index 5dc4ae6..e6c640c 100644 --- a/tests/integration/test_update_flow.py +++ b/tests/integration/test_update_flow.py @@ -97,6 +97,8 @@ class TestUpdateFlowIntegration: assert mock_fetch.call_count == 1 # Still 1, cache used # Verify both got same result + assert release1 is not None + assert release2 is not None assert release1.version == release2.version @pytest.mark.asyncio @@ -164,6 +166,7 @@ class TestUpdateFlowIntegration: release = await manager.check_for_updates() # Version should be extracted correctly (without 'v') + assert release is not None assert release.version == "1.2.3" @pytest.mark.asyncio @@ -180,6 +183,7 @@ class TestUpdateFlowIntegration: release = await manager.check_for_updates() # Should have both exe and checksum + assert release is not None assert len(release.assets) == 2 asset_names = [a["name"] for a in release.assets] assert "WebDropBridge.exe" in asset_names @@ -199,5 +203,6 @@ class TestUpdateFlowIntegration: release = await manager.check_for_updates() # Changelog should be available + assert release is not None assert release.body == mock_forgejo_response["body"] assert "Bug Fixes" in release.body