Xqt added a comment.
==================================== ERRORS
====================================
____________ ERROR at setup of TestUserRecentChanges.test_patrolled
____________
cls = <class 'tests.site_tests.TestUserRecentChanges'>
@classmethod
def setUpClass(cls):
"""
Set up the test class.
Skip the test class if the user config does not have
a valid login to the site.
"""
super().setUpClass()
sysop = hasattr(cls, 'sysop') and cls.sysop
for site_dict in cls.sites.values():
cls.require_site_user(
site_dict['family'], site_dict['code'], sysop)
if hasattr(cls, 'oauth') and cls.oauth:
continue
site = site_dict['site']
if site.siteinfo['readonly']:
raise unittest.SkipTest(
'Site {} has readonly state: {}'.format(
site, site.siteinfo.get('readonlyreason', '')))
with suppress(NoUsername):
> site.login()
tests/aspects.py:571:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
pywikibot/tools/__init__.py:1479: in wrapper
return obj(*__args, **__kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
self = APISite("en", "wikipedia"), sysop = None, autocreate = False
@deprecated_args(sysop=True)
def login(self, sysop=None, autocreate=False):
"""
Log the user in if not already logged in.
@param autocreate: if true, allow auto-creation of the account
using unified login
@type autocreate: bool
@raises pywikibot.exceptions.NoUsername: Username is not recognised
by the site.
@see: U{https://www.mediawiki.org/wiki/API:Login}
"""
if sysop is not None:
issue_deprecation_warning("'sysop' parameter",
warning_class=FutureWarning,
since='20201230')
# TODO: this should include an assert that loginstatus
# is not already IN_PROGRESS, however the
# login status may be left 'IN_PROGRESS' because
# of exceptions or if the first method of login
# (below) is successful. Instead, log the problem,
# to be increased to 'warning' level once majority
# of issues are resolved.
if self._loginstatus == _LoginStatus.IN_PROGRESS:
pywikibot.log(
'{!r}.login() called when a previous login was in progress.'
.format(self))
# There are several ways that the site may already be
# logged in, and we do not need to hit the server again.
# logged_in() is False if _userinfo exists, which means this
# will have no effect for the invocation from api.py
if self.logged_in():
self._loginstatus = _LoginStatus.AS_USER
return
# check whether a login cookie already exists for this user
# or check user identity when OAuth enabled
self._loginstatus = _LoginStatus.IN_PROGRESS
try:
del self.userinfo # force reload
if self.userinfo['name'] == self.user():
return
# May occur if you are not logged in (no API read permissions).
except api.APIError:
pass
except NoUsername as e:
if not autocreate:
raise e
if self.is_oauth_token_available():
if self.userinfo['name'] != self.username():
if self.username() is None:
raise NoUsername('No username has been defined in your '
'user-config.py: you have to add in
this '
'file the following line:\n'
"usernames['{family}']['{lang}'] "
"= '{username}'"
.format(family=self.family,
lang=self.lang,
username=self.userinfo['name']))
else:
raise NoUsername('Logged in on {site} via OAuth as '
'{wrong}, but expect as {right}'
.format(site=self,
wrong=self.userinfo['name'],
right=self.username()))
else:
raise NoUsername('Logging in on %s via OAuth failed' % self)
login_manager = api.LoginManager(site=self, user=self.username())
if login_manager.login(retry=True, autocreate=autocreate):
self._username = login_manager.username
del self.userinfo # force reloading
# load userinfo
assert self.userinfo['name'] == self.username(), \
> '{} != {}'.format(self.userinfo['name'], self.username())
E AssertionError: 104.154.182.187 != Pywikibot-test
pywikibot/site/__init__.py:342: AssertionError
TASK DETAIL
https://phabricator.wikimedia.org/T272773
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: Mpaa, Aklapper, pywikibot-bugs-list, Xqt, JohnsonLee01, SHEKH, Dijkstra,
Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa,
Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs