From 9d802b2a912aa0e459cf9ad0e9ec2fb51832b59e Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 6 Sep 2024 20:20:55 +0100 Subject: [PATCH] [Tests] Fix missing __qualname__ for mock callback test_pop_alerts raised the following error: File "/home/runner/work/deluge/deluge/deluge/core/alertmanager.py", line 177, in handle_alerts handler=handler.__qualname__, File "lib/python3.10/unittest/mock.py", line 645, in __getattr__ raise AttributeError(name) AttributeError: __qualname__ Mocks don't generate dunder methods like `__qualname__` attribute so we need to manually specify it. --- deluge/conftest.py | 1 + requirements.txt | 3 +-- setup.py | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/deluge/conftest.py b/deluge/conftest.py index c3070140d..19a0cff57 100644 --- a/deluge/conftest.py +++ b/deluge/conftest.py @@ -53,6 +53,7 @@ def mock_callback(): mock.deferred = deferred mock = Mock() + mock.__qualname__ = 'mock' original_reset_mock = mock.reset_mock mock.reset_mock = reset mock.reset_mock() diff --git a/requirements.txt b/requirements.txt index 3b2a4080d..a26ec758d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ libtorrent -twisted[tls]>=17.1; sys_platform != 'win32' -twisted[tls]<23,>=17.1; sys_platform == 'win32' +twisted[tls]>=17.1 rencode pyopenssl pyxdg diff --git a/setup.py b/setup.py index 509d383e4..ef70f20b0 100755 --- a/setup.py +++ b/setup.py @@ -538,8 +538,7 @@ _package_data['deluge.ui.gtk3'] = ['glade/*.ui'] setup_requires = ['setuptools', 'wheel'] install_requires = [ - "twisted[tls]>=17.1; sys_platform != 'win32'", - "twisted[tls]<23,>=17.1; sys_platform == 'win32'", + 'twisted[tls]>=17.1', # Add pyasn1 for setuptools workaround: # https://github.com/pypa/setuptools/issues/1510 'pyasn1',