mirror of
https://github.com/logos-storage/deluge.git
synced 2026-07-25 20:43:17 +00:00
The move to using auto-formatter makes it easier to read, submit and speeds up development time. https://github.com/ambv/black/ Although I would prefer 79 chars, the default line length of 88 chars used by black suffices. The flake8 line length remains at 120 chars since black does not touch comments or docstrings and this will require another round of fixes. The only black setting that is not standard is the use of double-quotes for strings so disabled any formatting of these. Note however that flake8 will still flag usage of double-quotes. I may change my mind on double vs single quotes but for now leave them. A new pyproject.toml file has been created for black configuration.
52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright (C) 2015 Calum Lind <calumlind@gmail.com>
|
|
# Copyright (C) 2010 Pedro Algarvio <ufs@ufsoft.org>
|
|
#
|
|
# 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 __future__ import unicode_literals
|
|
|
|
import logging
|
|
import warnings
|
|
|
|
from deluge.log import setup_logger
|
|
|
|
from .basetest import BaseTestCase
|
|
|
|
|
|
class LogTestCase(BaseTestCase):
|
|
def set_up(self):
|
|
setup_logger(logging.DEBUG)
|
|
|
|
def tear_down(self):
|
|
setup_logger('none')
|
|
|
|
def test_old_log_deprecation_warning(self):
|
|
from deluge.log import LOG
|
|
|
|
with warnings.catch_warnings(record=True) as w:
|
|
# Cause all warnings to always be triggered.
|
|
warnings.simplefilter('always')
|
|
LOG.debug('foo')
|
|
self.assertEqual(w[-1].category, DeprecationWarning)
|
|
|
|
# def test_twisted_error_log(self):
|
|
# from twisted.internet import defer
|
|
# import deluge.component as component
|
|
# from deluge.core.eventmanager import EventManager
|
|
# EventManager()
|
|
#
|
|
# d = component.start()
|
|
#
|
|
# @defer.inlineCallbacks
|
|
# def call(*args):
|
|
# yield component.pause(["EventManager"])
|
|
# yield component.start(["EventManager"])
|
|
#
|
|
# d.addCallback(call)
|
|
# return d
|