diff options
author | DjLegolas <djlegolas@protonmail.com> | 2021-12-28 22:20:57 +0200 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2021-12-29 21:51:07 +0000 |
commit | ec0bcc11f510cd113bbdb6cd551b27c697f03f53 (patch) | |
tree | c60c19a61a14fa157227ad7531406f250493b78e /deluge/tests | |
parent | 16895b4a492aedca8bcc2929a905207341c36b35 (diff) | |
download | deluge-ec0bcc11f510cd113bbdb6cd551b27c697f03f53.tar.gz deluge-ec0bcc11f510cd113bbdb6cd551b27c697f03f53.tar.bz2 deluge-ec0bcc11f510cd113bbdb6cd551b27c697f03f53.zip |
Upgrade codebase with pyupgrade (>=py3.6)
Added pyupgrade utility with manual stage to pre-commit and run on all
files.
Ref: https://github.com/asottile/pyupgrade
Closes: deluge-torrent/deluge#326
Diffstat (limited to 'deluge/tests')
37 files changed, 38 insertions, 75 deletions
diff --git a/deluge/tests/basetest.py b/deluge/tests/basetest.py index ac6514156..f51a93068 100644 --- a/deluge/tests/basetest.py +++ b/deluge/tests/basetest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/common.py b/deluge/tests/common.py index 170a2a288..ce5d83656 100644 --- a/deluge/tests/common.py +++ b/deluge/tests/common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # @@ -53,7 +52,7 @@ def todo_test(caller): filename = os.path.basename(traceback.extract_stack(None, 2)[0][0]) funcname = traceback.extract_stack(None, 2)[0][2] - raise unittest.SkipTest('TODO: %s:%s' % (filename, funcname)) + raise unittest.SkipTest(f'TODO: {filename}:{funcname}') def add_watchdog(deferred, timeout=0.05, message=None): @@ -71,7 +70,7 @@ def add_watchdog(deferred, timeout=0.05, message=None): return watchdog -class ReactorOverride(object): +class ReactorOverride: """Class used to patch reactor while running unit tests to avoid starting and stopping the twisted reactor """ diff --git a/deluge/tests/common_web.py b/deluge/tests/common_web.py index f2b82aad5..5a7f40fc6 100644 --- a/deluge/tests/common_web.py +++ b/deluge/tests/common_web.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # @@ -54,7 +53,7 @@ class WebServerTestBase(BaseTestCase, DaemonBase): return d -class WebServerMockBase(object): +class WebServerMockBase: """ Class with utility functions for mocking with tests using the webserver diff --git a/deluge/tests/daemon_base.py b/deluge/tests/daemon_base.py index 92ccf0c62..badc93768 100644 --- a/deluge/tests/daemon_base.py +++ b/deluge/tests/daemon_base.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -18,7 +17,7 @@ from . import common @pytest.mark.usefixtures('get_pytest_basetemp') -class DaemonBase(object): +class DaemonBase: basetemp = None if windows_check(): diff --git a/deluge/tests/test_alertmanager.py b/deluge/tests/test_alertmanager.py index b9dfce5a8..85512d47b 100644 --- a/deluge/tests/test_alertmanager.py +++ b/deluge/tests/test_alertmanager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_authmanager.py b/deluge/tests/test_authmanager.py index 31a79a857..cee399890 100644 --- a/deluge/tests/test_authmanager.py +++ b/deluge/tests/test_authmanager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_bencode.py b/deluge/tests/test_bencode.py index 420869139..05c6814b2 100644 --- a/deluge/tests/test_bencode.py +++ b/deluge/tests/test_bencode.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_client.py b/deluge/tests/test_client.py index bccbdd5e0..901bb85b0 100644 --- a/deluge/tests/test_client.py +++ b/deluge/tests/test_client.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_common.py b/deluge/tests/test_common.py index 7459997de..ccb468cb9 100644 --- a/deluge/tests/test_common.py +++ b/deluge/tests/test_common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_component.py b/deluge/tests/test_component.py index 5bdb16589..37cee03eb 100644 --- a/deluge/tests/test_component.py +++ b/deluge/tests/test_component.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_config.py b/deluge/tests/test_config.py index a514ebcf5..e8a267185 100644 --- a/deluge/tests/test_config.py +++ b/deluge/tests/test_config.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_core.py b/deluge/tests/test_core.py index 5e5815ca0..f33f60c4c 100644 --- a/deluge/tests/test_core.py +++ b/deluge/tests/test_core.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_decorators.py b/deluge/tests/test_decorators.py index 405a4ffc8..fc279f05f 100644 --- a/deluge/tests/test_decorators.py +++ b/deluge/tests/test_decorators.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -33,7 +32,7 @@ class DecoratorsTestCase(unittest.TestCase): def negate(func, *args, **kwargs): return -func(*args, **kwargs) - class Test(object): + class Test: def __init__(self, number): self.number = number diff --git a/deluge/tests/test_error.py b/deluge/tests/test_error.py index 29f19c429..1c2ff5f4b 100644 --- a/deluge/tests/test_error.py +++ b/deluge/tests/test_error.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_files_tab.py b/deluge/tests/test_files_tab.py index 108c4db0d..54664e093 100644 --- a/deluge/tests/test_files_tab.py +++ b/deluge/tests/test_files_tab.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -51,7 +50,7 @@ class FilesTabTestCase(BaseTestCase): level = 1 def p_level(s, l): - print('%s%s' % (' ' * l, s)) + print('{}{}'.format(' ' * l, s)) def _print_treestore_children(i, lvl): while i: diff --git a/deluge/tests/test_httpdownloader.py b/deluge/tests/test_httpdownloader.py index 649c43cab..69291fc7b 100644 --- a/deluge/tests/test_httpdownloader.py +++ b/deluge/tests/test_httpdownloader.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -8,7 +7,6 @@ import os import tempfile from email.utils import formatdate -from io import open from twisted.internet import reactor from twisted.internet.error import CannotListenError @@ -69,7 +67,7 @@ class TorrentResource(Resource): content_type += b'; charset=' + charset request.setHeader(b'Content-Type', content_type) request.setHeader(b'Content-Disposition', b'attachment; filename=test.torrent') - return 'Binary attachment ignore charset 世丕且\n'.encode('utf8') + return 'Binary attachment ignore charset 世丕且\n'.encode() class CookieResource(Resource): @@ -160,7 +158,7 @@ class DownloadFileTestCase(unittest.TestCase): return self.webserver.stopListening() def assertContains(self, filename, contents): # NOQA - with open(filename, 'r', encoding='utf8') as _file: + with open(filename, encoding='utf8') as _file: try: self.assertEqual(_file.read(), contents) except Exception as ex: @@ -168,7 +166,7 @@ class DownloadFileTestCase(unittest.TestCase): return filename def assertNotContains(self, filename, contents, file_mode=''): # NOQA - with open(filename, 'r', encoding='utf8') as _file: + with open(filename, encoding='utf8') as _file: try: self.assertNotEqual(_file.read(), contents) except Exception as ex: diff --git a/deluge/tests/test_json_api.py b/deluge/tests/test_json_api.py index 0e933e89e..765eb0e0b 100644 --- a/deluge/tests/test_json_api.py +++ b/deluge/tests/test_json_api.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # @@ -8,8 +7,8 @@ # import json as json_lib +from unittest.mock import MagicMock -from mock import MagicMock from twisted.internet import defer from twisted.web import server from twisted.web.http import Request diff --git a/deluge/tests/test_log.py b/deluge/tests/test_log.py index d5e1fdb53..424fd4720 100644 --- a/deluge/tests/test_log.py +++ b/deluge/tests/test_log.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2015 Calum Lind <calumlind@gmail.com> # Copyright (C) 2010 Pedro Algarvio <ufs@ufsoft.org> diff --git a/deluge/tests/test_maketorrent.py b/deluge/tests/test_maketorrent.py index ffab14b82..90ca61a3c 100644 --- a/deluge/tests/test_maketorrent.py +++ b/deluge/tests/test_maketorrent.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_metafile.py b/deluge/tests/test_metafile.py index d3099c692..af8f72d40 100644 --- a/deluge/tests/test_metafile.py +++ b/deluge/tests/test_metafile.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_plugin_metadata.py b/deluge/tests/test_plugin_metadata.py index e7c14b591..341839e22 100644 --- a/deluge/tests/test_plugin_metadata.py +++ b/deluge/tests/test_plugin_metadata.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2015 Calum Lind <calumlind@gmail.com> # @@ -21,7 +20,7 @@ class PluginManagerBaseTestCase(BaseTestCase): pm = PluginManagerBase('core.conf', 'deluge.plugin.core') for p in pm.get_available_plugins(): for key, value in pm.get_plugin_info(p).items(): - self.assertTrue(isinstance('%s: %s' % (key, value), ''.__class__)) + self.assertTrue(isinstance(f'{key}: {value}', ''.__class__)) def test_get_plugin_info_invalid_name(self): pm = PluginManagerBase('core.conf', 'deluge.plugin.core') diff --git a/deluge/tests/test_rpcserver.py b/deluge/tests/test_rpcserver.py index 59d84304a..ab0844038 100644 --- a/deluge/tests/test_rpcserver.py +++ b/deluge/tests/test_rpcserver.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2013 Bro <bro.development@gmail.com> # diff --git a/deluge/tests/test_security.py b/deluge/tests/test_security.py index 6154d32d8..6fac802e8 100644 --- a/deluge/tests/test_security.py +++ b/deluge/tests/test_security.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -24,7 +23,7 @@ from .daemon_base import DaemonBase SECURITY_TESTS = bool(os.getenv('SECURITY_TESTS', False)) -class SecurityBaseTestCase(object): +class SecurityBaseTestCase: if windows_check(): skip = 'windows cannot run .sh files' elif not SECURITY_TESTS: @@ -134,7 +133,7 @@ class DaemonSecurityTestCase(BaseTestCase, DaemonBase, SecurityBaseTestCase): skip = 'windows cannot start_core not enough arguments for format string' def __init__(self, testname): - super(DaemonSecurityTestCase, self).__init__(testname) + super().__init__(testname) DaemonBase.__init__(self) SecurityBaseTestCase.__init__(self) @@ -145,7 +144,7 @@ class DaemonSecurityTestCase(BaseTestCase, DaemonBase, SecurityBaseTestCase): self.skipTest(SecurityBaseTestCase.http_err) skip = True if not skip: - super(DaemonSecurityTestCase, self).setUp() + super().setUp() def set_up(self): d = self.common_set_up() @@ -163,7 +162,7 @@ class DaemonSecurityTestCase(BaseTestCase, DaemonBase, SecurityBaseTestCase): @pytest.mark.security class WebUISecurityTestBase(WebServerTestBase, SecurityBaseTestCase): def __init__(self, testname): - super(WebUISecurityTestBase, self).__init__(testname) + super().__init__(testname) SecurityBaseTestCase.__init__(self) def start_webapi(self, arg): diff --git a/deluge/tests/test_sessionproxy.py b/deluge/tests/test_sessionproxy.py index 88400342b..f73e522f1 100644 --- a/deluge/tests/test_sessionproxy.py +++ b/deluge/tests/test_sessionproxy.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # @@ -16,7 +15,7 @@ import deluge.ui.sessionproxy from .basetest import BaseTestCase -class Core(object): +class Core: def __init__(self): self.reset() @@ -89,7 +88,7 @@ class Core(object): return succeed(ret) -class Client(object): +class Client: def __init__(self): self.core = Core() diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py index c8372f5c1..8d22403fc 100644 --- a/deluge/tests/test_torrent.py +++ b/deluge/tests/test_torrent.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -8,8 +7,8 @@ import os import time from base64 import b64encode +from unittest import mock -import mock from twisted.internet import defer, reactor from twisted.internet.task import deferLater from twisted.trial import unittest diff --git a/deluge/tests/test_torrentmanager.py b/deluge/tests/test_torrentmanager.py index 1be5ba3ac..d719889ba 100644 --- a/deluge/tests/test_torrentmanager.py +++ b/deluge/tests/test_torrentmanager.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -9,8 +8,8 @@ import os import shutil import warnings from base64 import b64encode +from unittest import mock -import mock import pytest from twisted.internet import defer, task from twisted.trial import unittest diff --git a/deluge/tests/test_torrentview.py b/deluge/tests/test_torrentview.py index 1153e968f..72995f6e2 100644 --- a/deluge/tests/test_torrentview.py +++ b/deluge/tests/test_torrentview.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2014 Bro <bro.development@gmail.com> # Copyright (C) 2014 Calum Lind <calumlind@gmail.com> diff --git a/deluge/tests/test_tracker_icons.py b/deluge/tests/test_tracker_icons.py index 0f7a66c61..c8e2f32d9 100644 --- a/deluge/tests/test_tracker_icons.py +++ b/deluge/tests/test_tracker_icons.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. diff --git a/deluge/tests/test_transfer.py b/deluge/tests/test_transfer.py index f38833f77..a67e0da03 100644 --- a/deluge/tests/test_transfer.py +++ b/deluge/tests/test_transfer.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2012 Bro <bro.development@gmail.com> # diff --git a/deluge/tests/test_ui_common.py b/deluge/tests/test_ui_common.py index d9df0f4d3..809abbd8e 100644 --- a/deluge/tests/test_ui_common.py +++ b/deluge/tests/test_ui_common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # diff --git a/deluge/tests/test_ui_console.py b/deluge/tests/test_ui_console.py index eacf170da..201feee70 100644 --- a/deluge/tests/test_ui_console.py +++ b/deluge/tests/test_ui_console.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -14,7 +13,7 @@ from deluge.ui.console.widgets.fields import TextInput from .basetest import BaseTestCase -class MockParent(object): +class MockParent: def __init__(self): self.border_off_x = 1 self.pane_width = 20 diff --git a/deluge/tests/test_ui_entry.py b/deluge/tests/test_ui_entry.py index 0699dabc6..a01653bb1 100644 --- a/deluge/tests/test_ui_entry.py +++ b/deluge/tests/test_ui_entry.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # @@ -10,8 +9,8 @@ import argparse import sys from io import StringIO +from unittest import mock -import mock import pytest from twisted.internet import defer @@ -39,7 +38,7 @@ sys_stdout = sys.stdout # To print to terminal from the tests, use: print('Message...', file=sys_stdout) -class StringFileDescriptor(object): +class StringFileDescriptor: """File descriptor that writes to string buffer""" def __init__(self, fd): @@ -56,7 +55,7 @@ class StringFileDescriptor(object): self.out.flush() -class UIBaseTestCase(object): +class UIBaseTestCase: def __init__(self): self.var = {} @@ -170,7 +169,7 @@ class GtkUIBaseTestCase(UIBaseTestCase): @pytest.mark.gtkui class GtkUIDelugeScriptEntryTestCase(BaseTestCase, GtkUIBaseTestCase): def __init__(self, testname): - super(GtkUIDelugeScriptEntryTestCase, self).__init__(testname) + super().__init__(testname) GtkUIBaseTestCase.__init__(self) self.var['cmd_name'] = 'deluge gtk' @@ -187,7 +186,7 @@ class GtkUIDelugeScriptEntryTestCase(BaseTestCase, GtkUIBaseTestCase): @pytest.mark.gtkui class GtkUIScriptEntryTestCase(BaseTestCase, GtkUIBaseTestCase): def __init__(self, testname): - super(GtkUIScriptEntryTestCase, self).__init__(testname) + super().__init__(testname) GtkUIBaseTestCase.__init__(self) from deluge.ui import gtk3 @@ -246,7 +245,7 @@ class WebUIScriptEntryTestCase(BaseTestCase, WebUIBaseTestCase): skip = 'Console ui test on Windows broken due to sys args issue' def __init__(self, testname): - super(WebUIScriptEntryTestCase, self).__init__(testname) + super().__init__(testname) WebUIBaseTestCase.__init__(self) self.var['cmd_name'] = 'deluge-web' self.var['start_cmd'] = deluge.ui.web.start @@ -265,7 +264,7 @@ class WebUIDelugeScriptEntryTestCase(BaseTestCase, WebUIBaseTestCase): skip = 'Console ui test on Windows broken due to sys args issue' def __init__(self, testname): - super(WebUIDelugeScriptEntryTestCase, self).__init__(testname) + super().__init__(testname) WebUIBaseTestCase.__init__(self) self.var['cmd_name'] = 'deluge web' self.var['start_cmd'] = ui_entry.start_ui @@ -458,7 +457,7 @@ class ConsoleScriptEntryWithDaemonTestCase( skip = 'Console ui test on Windows broken due to sys args issue' def __init__(self, testname): - super(ConsoleScriptEntryWithDaemonTestCase, self).__init__(testname) + super().__init__(testname) ConsoleUIWithDaemonBaseTestCase.__init__(self) self.var['cmd_name'] = 'deluge-console' self.var['sys_arg_cmd'] = ['./deluge-console'] @@ -484,7 +483,7 @@ class ConsoleScriptEntryTestCase(BaseTestCase, ConsoleUIBaseTestCase): skip = 'Console ui test on Windows broken due to sys args issue' def __init__(self, testname): - super(ConsoleScriptEntryTestCase, self).__init__(testname) + super().__init__(testname) ConsoleUIBaseTestCase.__init__(self) self.var['cmd_name'] = 'deluge-console' self.var['start_cmd'] = deluge.ui.console.start @@ -503,7 +502,7 @@ class ConsoleDelugeScriptEntryTestCase(BaseTestCase, ConsoleUIBaseTestCase): skip = 'cannot test console ui on windows' def __init__(self, testname): - super(ConsoleDelugeScriptEntryTestCase, self).__init__(testname) + super().__init__(testname) ConsoleUIBaseTestCase.__init__(self) self.var['cmd_name'] = 'deluge console' self.var['start_cmd'] = ui_entry.start_ui diff --git a/deluge/tests/test_ui_gtk3.py b/deluge/tests/test_ui_gtk3.py index fb8f9e6d3..707a3ef2d 100644 --- a/deluge/tests/test_ui_gtk3.py +++ b/deluge/tests/test_ui_gtk3.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -6,8 +5,8 @@ # import sys +from unittest import mock -import mock import pytest from twisted.trial import unittest diff --git a/deluge/tests/test_web_api.py b/deluge/tests/test_web_api.py index 96b5234b1..8bac165e7 100644 --- a/deluge/tests/test_web_api.py +++ b/deluge/tests/test_web_api.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # @@ -75,9 +74,9 @@ class WebAPITestCase(WebServerTestBase): } self.deluge_web.web_api.set_config(config) web_config = component.get('DelugeWeb').config.config - self.assertNotEquals(config['pwd_salt'], web_config['pwd_salt']) - self.assertNotEquals(config['pwd_sha1'], web_config['pwd_sha1']) - self.assertNotEquals(config['sessions'], web_config['sessions']) + self.assertNotEqual(config['pwd_salt'], web_config['pwd_salt']) + self.assertNotEqual(config['pwd_sha1'], web_config['pwd_sha1']) + self.assertNotEqual(config['sessions'], web_config['sessions']) @defer.inlineCallbacks def get_host_status(self): diff --git a/deluge/tests/test_web_auth.py b/deluge/tests/test_web_auth.py index 84a5586f4..9ca906108 100644 --- a/deluge/tests/test_web_auth.py +++ b/deluge/tests/test_web_auth.py @@ -1,16 +1,16 @@ -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # -from mock import patch +from unittest.mock import patch + from twisted.trial import unittest from deluge.ui.web import auth -class MockConfig(object): +class MockConfig: def __init__(self, config): self.config = config diff --git a/deluge/tests/test_webserver.py b/deluge/tests/test_webserver.py index cdb0ee6ba..37a0c0d28 100644 --- a/deluge/tests/test_webserver.py +++ b/deluge/tests/test_webserver.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com> # diff --git a/deluge/tests/twisted/plugins/delugereporter.py b/deluge/tests/twisted/plugins/delugereporter.py index 66e9a48b2..7f07edba7 100644 --- a/deluge/tests/twisted/plugins/delugereporter.py +++ b/deluge/tests/twisted/plugins/delugereporter.py @@ -1,5 +1,4 @@ #! /usr/bin/env python -# -*- coding: utf-8 -*- # # This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with # the additional special exception to link portions of this program with the OpenSSL library. @@ -14,7 +13,7 @@ from twisted.trial.reporter import TreeReporter from zope.interface import implements -class _Reporter(object): +class _Reporter: implements(IPlugin, IReporter) def __init__( |