1
0
Fork 0

Compare commits

..

2 commits

Author SHA1 Message Date
83be4bae11
Releasing debian version 2.1.2~dev0+20250301-1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-03-21 01:38:45 +01:00
5369fed815
Merging upstream version 2.1.2~dev0+20250301.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-03-21 01:38:30 +01:00
9 changed files with 47 additions and 38 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
deluge (2.1.2~dev0+20250301-1) sid; urgency=medium
* Merging upstream version 2.1.2~dev0+20250301.
-- Daniel Baumann <daniel@debian.org> Fri, 21 Mar 2025 01:38:41 +0100
deluge (2.1.2~dev0+20240910-6) sid; urgency=medium
* Updating to standards version 4.7.1.

View file

@ -196,11 +196,27 @@ def activate(self):
d = defer.ensureDeferred(self.coro)
d.chainDeferred(self)
def addCallbacks(self, *args, **kwargs): # noqa: N802
def _callback_activate(self):
"""Verify awaited status before calling activate."""
assert not self.awaited, 'Cannot add callbacks to an already awaited coroutine.'
self.activate()
def addCallback(self, *args, **kwargs): # noqa: N802
self._callback_activate()
return super().addCallback(*args, **kwargs)
def addCallbacks(self, *args, **kwargs): # noqa: N802
self._callback_activate()
return super().addCallbacks(*args, **kwargs)
def addErrback(self, *args, **kwargs): # noqa: N802
self._callback_activate()
return super().addErrback(*args, **kwargs)
def addBoth(self, *args, **kwargs): # noqa: N802
self._callback_activate()
return super().addBoth(*args, **kwargs)
_RetT = TypeVar('_RetT')

View file

@ -199,6 +199,8 @@ def test_set_prioritize_first_last_pieces_false(self):
# self.print_priority_list(priorities)
def test_torrent_error_data_missing(self):
if VersionSplit(lt.__version__) > VersionSplit('2.0.7.0'):
pytest.xfail('Test not working as expected after lt 2.0.7')
options = {'seed_mode': True}
filename = common.get_test_data_file('test_torrent.file.torrent')
with open(filename, 'rb') as _file:
@ -214,6 +216,8 @@ def test_torrent_error_data_missing(self):
self.assert_state_wait(torrent, 'Error')
def test_torrent_error_resume_original_state(self):
if VersionSplit(lt.__version__) > VersionSplit('2.0.7.0'):
pytest.xfail('Test not working as expected after lt 2.0.7')
options = {'seed_mode': True, 'add_paused': True}
filename = common.get_test_data_file('test_torrent.file.torrent')
with open(filename, 'rb') as _file:
@ -233,7 +237,7 @@ def test_torrent_error_resume_original_state(self):
def test_torrent_error_resume_data_unaltered(self):
if VersionSplit(lt.__version__) >= VersionSplit('1.2.0.0'):
pytest.skip('Test not working as expected on lt 1.2 or greater')
pytest.xfail('Test not working as expected on lt 1.2 or greater')
resume_data = {
'active_time': 13399,

View file

@ -12,8 +12,6 @@
from unittest import mock
import pytest
import pytest_twisted
from twisted.internet import defer
import deluge
import deluge.component as component
@ -27,7 +25,6 @@
from deluge.ui.web.server import DelugeWeb
from . import common
from .daemon_base import DaemonBase
DEBUG_COMMAND = False
@ -70,15 +67,6 @@ def exec_command(self):
return self.var['start_cmd']()
class UIWithDaemonBaseTestCase(UIBaseTestCase, DaemonBase):
"""Subclass for test that require a deluged daemon"""
def set_up(self):
d = self.common_set_up()
common.setup_test_logger(level='info', prefix=self.config_dir / self.id())
return d
class TestDelugeEntry(BaseTestCase):
def set_up(self):
return component.start()
@ -321,13 +309,13 @@ def test_console_unrecognized_arguments(self):
assert 'unrecognized arguments: --ui' in fd.out.getvalue()
class ConsoleUIWithDaemonBaseTestCase(UIWithDaemonBaseTestCase):
class ConsoleUIWithDaemonBaseTestCase(UIBaseTestCase):
"""Implement Console tests that require a running daemon"""
def set_up(self):
# Avoid calling reactor.shutdown after commands are executed by main.exec_args()
deluge.ui.console.main.reactor = common.ReactorOverride()
return UIWithDaemonBaseTestCase.set_up(self)
return super().set_up()
def patch_arg_command(self, command):
if isinstance(command, str):
@ -346,14 +334,13 @@ def patch_arg_command(self, command):
+ command,
)
@pytest_twisted.inlineCallbacks
def test_console_command_add(self):
async def test_console_command_add(self):
filename = common.get_test_data_file('test.torrent')
self.patch_arg_command([f'add "{filename}"'])
fd = StringFileDescriptor(sys.stdout)
self.patch(sys, 'stdout', fd)
yield self.exec_command()
await self.exec_command()
std_output = fd.out.getvalue()
assert (
@ -361,8 +348,7 @@ def test_console_command_add(self):
== 'Attempting to add torrent: ' + filename + '\nTorrent added!\n'
)
@pytest_twisted.inlineCallbacks
def test_console_command_add_move_completed(self):
async def test_console_command_add_move_completed(self):
filename = common.get_test_data_file('test.torrent')
tmp_path = 'c:\\tmp' if windows_check() else '/tmp'
self.patch_arg_command(
@ -377,7 +363,7 @@ def test_console_command_add_move_completed(self):
fd = StringFileDescriptor(sys.stdout)
self.patch(sys, 'stdout', fd)
yield self.exec_command()
await self.exec_command()
std_output = fd.out.getvalue()
assert std_output.endswith(
@ -397,20 +383,19 @@ async def test_console_command_status(self):
assert std_output.startswith('Total upload: ')
assert std_output.endswith(' Moving: 0\n')
@defer.inlineCallbacks
def test_console_command_config_set_download_location(self):
async def test_console_command_config_set_download_location(self):
fd = StringFileDescriptor(sys.stdout)
self.patch_arg_command(['config --set download_location /downloads'])
self.patch(sys, 'stdout', fd)
yield self.exec_command()
await self.exec_command()
std_output = fd.out.getvalue()
assert std_output.startswith('Setting "download_location" to: \'/downloads\'')
assert std_output.endswith('Configuration value successfully updated.\n')
@pytest.mark.usefixtures('daemon', 'client')
class TestConsoleScriptEntryWithDaemon(BaseTestCase, ConsoleUIWithDaemonBaseTestCase):
@pytest.mark.usefixtures('daemon', 'client', 'base_fixture')
class TestConsoleScriptEntryWithDaemon(ConsoleUIWithDaemonBaseTestCase):
@pytest.fixture(autouse=True)
def set_var(self, request):
request.cls.var = {

View file

@ -9,6 +9,8 @@
import logging
from twisted.internet import defer
import deluge.component as component
from deluge.ui.client import client
@ -63,7 +65,7 @@ def handle(self, options):
_('Confirm with -c to remove the listed torrents (Count: %d)')
% len(torrent_ids)
)
return
return defer.succeed(True)
def on_removed_finished(errors):
if errors:
@ -76,6 +78,7 @@ def on_removed_finished(errors):
log.info('Removing %d torrents', len(torrent_ids))
d = client.core.remove_torrents(torrent_ids, options.remove_data)
d.addCallback(on_removed_finished)
return d
def complete(self, line):
# We use the ConsoleUI torrent tab complete method

View file

@ -493,7 +493,7 @@ def on_button_add_clicked(self, widget):
*textview_buf.get_bounds(), include_hidden_chars=False
)
log.debug('Create torrent tracker lines: %s', trackers_text)
self.config['createtorrent.trackers'] = trackers_text.split('/n')
self.config['createtorrent.trackers'] = trackers_text.splitlines()
# Append trackers liststore with unique trackers and tiers starting from last tier number.
last_tier, orig_trackers = last_tier_trackers_from_liststore(

View file

@ -782,7 +782,7 @@ def add_texticon_column(
return True
def on_keypress_search_by_name(self, model, column, key, _iter):
def on_keypress_search_by_name(self, model, column, key, _iter, *search_data):
torrent_name_col = self.columns[_('Name')].column_indices[1]
return not model[_iter][torrent_name_col].lower().startswith(key.lower())

View file

@ -461,15 +461,12 @@ def resize_icon(self, icon):
# Requires Pillow(PIL) to resize.
if icon and Image:
filename = icon.get_filename()
remove_old = False
with Image.open(filename) as img:
new_filename = os.path.splitext(filename)[0] + '.png'
if img.size > (16, 16):
new_filename = filename.rpartition('.')[0] + '.png'
img = img.resize((16, 16), Image.Resampling.LANCZOS)
img.save(new_filename)
if new_filename != filename:
remove_old = True
if remove_old:
img.save(new_filename)
if new_filename != filename:
os.remove(filename)
icon = TrackerIcon(new_filename)
return icon

View file

@ -1,4 +1,2 @@
-r requirements.txt
-r requirements-tests.txt
libtorrent==2.0.7
pytest==7.4.2