Xqt created this task.
Xqt added a project: Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
Restricted Application added a project: Pywikibot.
TASK DESCRIPTION
Some login tests fails due to TypeError: __init__() takes from 1 to 4
positional arguments but 5 were given.
The reason is that keyword arguments are invoked as positional aguments
within tests.
=================================== FAILURES
===================================
______________________ TestOauthLoginManger.test_identity
______________________
self = <tests.oauth_tests.TestOauthLoginManger testMethod=test_identity>
def test_identity(self):
"""Test identity."""
> login_manager = self._get_login_manager()
tests/oauth_tests.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
tests/oauth_tests.py:62: in _get_login_manager
login_manager = OauthLoginManager(self.consumer_token[1], False,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
__args = (<pywikibot.login.OauthLoginManager object at 0x7fafde1fbbb0>,
'fe39000d3d114bf801e3a92b584a181cf38942f9', False, APISite("test",
"wikipedia"), 'e0ef943a1890b04d656409e64641c0ba')
__kw = {}, name = 'pywikibot.login.OauthLoginManager.__init__', depth = 2
old_arg = 'sysop', new_arg = None
output_args = {'name': 'pywikibot.login.OauthLoginManager.__init__',
'new_arg': None, 'old_arg': 'sysop'}
def wrapper(*__args, **__kw):
"""Replacement function.
@param __args: args passed to the decorated function
@param __kw: kwargs passed to the decorated function
@return: the value returned by the decorated function
@rtype: any
"""
name = obj.__full_name__
depth = get_wrapper_depth(wrapper) + 1
for old_arg, new_arg in arg_pairs.items():
output_args = {
'name': name,
'old_arg': old_arg,
'new_arg': new_arg,
}
if old_arg in __kw:
if new_arg not in [True, False, None]:
if new_arg in __kw:
warn('%(new_arg)s argument of %(name)s '
'replaces %(old_arg)s; cannot use both.'
% output_args,
RuntimeWarning, depth)
else:
# If the value is positionally given this will
# cause a TypeError, which is intentional
warn('%(old_arg)s argument of %(name)s '
'is deprecated; use %(new_arg)s instead.'
% output_args,
DeprecationWarning, depth)
__kw[new_arg] = __kw[old_arg]
else:
if new_arg is False:
cls = PendingDeprecationWarning
else:
cls = DeprecationWarning
warn('%(old_arg)s argument of %(name)s is deprecated.'
% output_args,
cls, depth)
del __kw[old_arg]
> return obj(*__args, **__kw)
E TypeError: __init__() takes from 1 to 4 positional arguments but 5
were given
pywikibot/tools/__init__.py:1744: TypeError
_______________________ TestOauthLoginManger.test_login
________________________
self = <tests.oauth_tests.TestOauthLoginManger testMethod=test_login>
def test_login(self):
"""Test login."""
> login_manager = self._get_login_manager()
tests/oauth_tests.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
tests/oauth_tests.py:62: in _get_login_manager
login_manager = OauthLoginManager(self.consumer_token[1], False,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
__args = (<pywikibot.login.OauthLoginManager object at 0x7fafde20aa30>,
'fe39000d3d114bf801e3a92b584a181cf38942f9', False, APISite("test",
"wikipedia"), 'e0ef943a1890b04d656409e64641c0ba')
__kw = {}, name = 'pywikibot.login.OauthLoginManager.__init__', depth = 2
old_arg = 'sysop', new_arg = None
output_args = {'name': 'pywikibot.login.OauthLoginManager.__init__',
'new_arg': None, 'old_arg': 'sysop'}
def wrapper(*__args, **__kw):
"""Replacement function.
@param __args: args passed to the decorated function
@param __kw: kwargs passed to the decorated function
@return: the value returned by the decorated function
@rtype: any
"""
name = obj.__full_name__
depth = get_wrapper_depth(wrapper) + 1
for old_arg, new_arg in arg_pairs.items():
output_args = {
'name': name,
'old_arg': old_arg,
'new_arg': new_arg,
}
if old_arg in __kw:
if new_arg not in [True, False, None]:
if new_arg in __kw:
warn('%(new_arg)s argument of %(name)s '
'replaces %(old_arg)s; cannot use both.'
% output_args,
RuntimeWarning, depth)
else:
# If the value is positionally given this will
# cause a TypeError, which is intentional
warn('%(old_arg)s argument of %(name)s '
'is deprecated; use %(new_arg)s instead.'
% output_args,
DeprecationWarning, depth)
__kw[new_arg] = __kw[old_arg]
else:
if new_arg is False:
cls = PendingDeprecationWarning
else:
cls = DeprecationWarning
warn('%(old_arg)s argument of %(name)s is deprecated.'
% output_args,
cls, depth)
del __kw[old_arg]
> return obj(*__args, **__kw)
E TypeError: __init__() takes from 1 to 4 positional arguments but 5
were given
pywikibot/tools/__init__.py:1744: TypeError
TASK DETAIL
https://phabricator.wikimedia.org/T237501
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: Huji, Aklapper, Xqt, pywikibot-bugs-list, Zkhalido, Viztor, DannyS712,
Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis,
mys_721tx, jayvdb, Dalba, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs