Mpaa created this task.
Mpaa added a project: Pywikibot-core.
Herald added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
import pywikibot
import pywikibot.logging

from pywikibot.bot import init_handlers
from pywikibot.tools import deprecated_args

_logger = 'test'
init_handlers()

@deprecated_args(x='y')
def bar(y):
    pass
user@pc:~/python/core {master}$ python3 test_warn.py 
WARNING: test_warn.py:19: DeprecationWarning: x argument of __main__.bar is deprecated; use y instead.
  bar(x=3)

--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.4/logging/handlers.py", line 71, in emit
    if self.shouldRollover(record):
  File "/usr/lib/python3.4/logging/handlers.py", line 187, in shouldRollover
    msg = "%s\n" % self.format(record)
  File "/home/user/python/core/pywikibot/tools/_logging.py", line 88, in format
    'Record argument should start with path'
AssertionError: Record argument should start with path
Call stack:
  File "test_warn.py", line 19, in <module>
    bar(x=3)
  File "/home/user/python/core/pywikibot/tools/__init__.py", line 1437, in wrapper
    DeprecationWarning, depth)
Message: '%s'
Arguments: ('test_warn.py:19: DeprecationWarning: x argument of __main__.bar is deprecated; use y instead.\n  bar(x=3)\n',)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.4/logging/handlers.py", line 71, in emit
    if self.shouldRollover(record):
  File "/usr/lib/python3.4/logging/handlers.py", line 187, in shouldRollover
    msg = "%s\n" % self.format(record)
  File "/home/user/python/core/pywikibot/tools/_logging.py", line 88, in format
    'Record argument should start with path'
AssertionError: Record argument should start with path
Call stack:
  File "test_warn.py", line 19, in <module>
    bar(x=3)
  File "/home/user/python/core/pywikibot/tools/__init__.py", line 1437, in wrapper
    DeprecationWarning, depth)
Message: '%s'
Arguments: ('test_warn.py:19: DeprecationWarning: x argument of __main__.bar is deprecated; use y instead.\n  bar(x=3)\n',)
user@pc:~/python/core {master}$ python2 test_warn.py 
WARNING: test_warn.py:19: DeprecationWarning: x argument of __main__.bar is deprecated; use y instead.
  bar(x=3)

TASK DETAIL
https://phabricator.wikimedia.org/T159077

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Mpaa
Cc: Aklapper, pywikibot-bugs-list, Mpaa, MarcAbonce, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, Sn1per, jayvdb, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to