[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.
This commit is contained in:
Calum Lind 2024-09-06 20:20:55 +01:00
parent 8867da94f8
commit 9d802b2a91
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
3 changed files with 3 additions and 4 deletions

View File

@ -53,6 +53,7 @@ def mock_callback():
mock.deferred = deferred mock.deferred = deferred
mock = Mock() mock = Mock()
mock.__qualname__ = 'mock'
original_reset_mock = mock.reset_mock original_reset_mock = mock.reset_mock
mock.reset_mock = reset mock.reset_mock = reset
mock.reset_mock() mock.reset_mock()

View File

@ -1,6 +1,5 @@
libtorrent libtorrent
twisted[tls]>=17.1; sys_platform != 'win32' twisted[tls]>=17.1
twisted[tls]<23,>=17.1; sys_platform == 'win32'
rencode rencode
pyopenssl pyopenssl
pyxdg pyxdg

View File

@ -538,8 +538,7 @@ _package_data['deluge.ui.gtk3'] = ['glade/*.ui']
setup_requires = ['setuptools', 'wheel'] setup_requires = ['setuptools', 'wheel']
install_requires = [ install_requires = [
"twisted[tls]>=17.1; sys_platform != 'win32'", 'twisted[tls]>=17.1',
"twisted[tls]<23,>=17.1; sys_platform == 'win32'",
# Add pyasn1 for setuptools workaround: # Add pyasn1 for setuptools workaround:
# https://github.com/pypa/setuptools/issues/1510 # https://github.com/pypa/setuptools/issues/1510
'pyasn1', 'pyasn1',