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
test_preload_langlinks_normal and test_preload_langlinks_count
site_tests.TestPagePreloading Fails due to unknown site 'de' in wsbeta Family:
_______________ TestPagePreloading.test_preload_langlinks_normal
_______________
self = <tests.site_tests.TestPagePreloading
testMethod=test_preload_langlinks_normal>
def test_preload_langlinks_normal(self):
"""Test preloading langlinks works."""
mysite = self.get_site()
links = mysite.pagelinks(self.get_mainpage(), total=10)
gen = mysite.preloadpages(links, groupsize=5, langlinks=True)
> for count, page in enumerate(gen):
tests/site_tests.py:3019:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
pywikibot/site/__init__.py:1714: in preloadpages
api.update_page(page, pagedata, rvgen.props)
pywikibot/data/api.py:3181: in update_page
_update_langlinks(page, pagedict['langlinks'])
pywikibot/data/api.py:3110: in _update_langlinks
for link in langlinks]
pywikibot/data/api.py:3110: in <listcomp>
for link in langlinks]
pywikibot/page/__init__.py:5981: in langlinkUnsafe
link._site = pywikibot.Site(lang, source.family.name)
pywikibot/tools/__init__.py:1479: in wrapper
return obj(*__args, **__kw)
pywikibot/__init__.py:1153: in Site
_sites[key] = interface(code=code, fam=fam, user=user)
pywikibot/tools/__init__.py:1562: in wrapper
return obj(*new_args, **new_kwargs)
pywikibot/site/__init__.py:110: in __init__
super().__init__(code, fam, user)
pywikibot/tools/__init__.py:1562: in wrapper
return obj(*new_args, **new_kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _
self = APISite("de", "wsbeta"), code = 'de', fam = Family("wsbeta"), user =
None
@remove_last_args(['sysop'])
def __init__(self, code: str, fam=None, user=None) -> None:
"""
Initializer.
@param code: the site's language code
@type code: str
@param fam: wiki family name (optional)
@type fam: str or pywikibot.family.Family
@param user: bot user name (optional)
@type user: str
"""
if code.lower() != code:
# Note the Site function in __init__ also emits a UserWarning
# for this condition, showing the callers file and line no.
pywikibot.log('BaseSite: code "{}" converted to lowercase'
.format(code))
code = code.lower()
if not all(x in pywikibot.family.CODE_CHARACTERS for x in code):
pywikibot.log('BaseSite: code "{}" contains invalid characters'
.format(code))
self.__code = code
if isinstance(fam, str) or fam is None:
self.__family = pywikibot.family.Family.load(fam)
else:
self.__family = fam
self.obsolete = False
# if we got an outdated language code, use the new one instead.
if self.__code in self.__family.obsolete:
if self.__family.obsolete[self.__code] is not None:
self.__code = self.__family.obsolete[self.__code]
# Note the Site function in __init__ emits a UserWarning
# for this condition, showing the callers file and line no.
pywikibot.log('Site {} instantiated using aliases code of
{}'
.format(self, code))
else:
# no such language anymore
self.obsolete = True
pywikibot.log('Site %s instantiated and marked "obsolete" '
'to prevent access' % self)
elif self.__code not in self.languages():
if self.__family.name in self.__family.langs and \
len(self.__family.langs) == 1:
self.__code = self.__family.name
if self.__family == pywikibot.config.family \
and code == pywikibot.config.mylang:
pywikibot.config.mylang = self.__code
warn('Global configuration variable "mylang" changed to
'
'"%s" while instantiating site %s'
% (self.__code, self), UserWarning)
else:
raise UnknownSite("Language '%s' does not exist in family
%s"
> % (self.__code, self.__family.name))
E pywikibot.exceptions.UnknownSite: Language 'de' does not
exist in family wsbeta
pywikibot/site/_basesite.py:90: UnknownSite
https://api.travis-ci.org/v3/job/756234342/log.txt
TASK DETAIL
https://phabricator.wikimedia.org/T273155
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: Aklapper, Xqt, pywikibot-bugs-list, 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