Dalba created this task.
Dalba added projects: Pywikibot-core, Pywikibot-tests.
Herald added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION

https://travis-ci.org/wikimedia/pywikibot/jobs/399630623#L1573

______________ TestSiteGenerators.test_allpages_langlinks_enabled ______________
self = <tests.site_tests.TestSiteGenerators testMethod=test_allpages_langlinks_enabled>
    def test_allpages_langlinks_enabled(self):
        """Test allpages with langlinks enabled."""
        mysite = self.get_site()
        for page in mysite.allpages(
                filterlanglinks=True, total=3, namespace=4):
            self.assertIsInstance(page, pywikibot.Page)
            self.assertTrue(page.exists())
            self.assertEqual(page.namespace(), 4)
>           self.assertNotEqual(page.langlinks(), [])
tests/site_tests.py:680: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/page.py:1499: in langlinks
    self._langlinks = list(self.iterlanglinks(include_obsolete=True))
pywikibot/site.py:4145: in pagelanglinks
    source=self)
pywikibot/page.py:5879: in langlinkUnsafe
    link._site = pywikibot.Site(lang, source.family.name)
pywikibot/__init__.py:1275: in Site
    _sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
pywikibot/site.py:1845: in __init__
    BaseSite.__init__(self, code, fam, user, sysop)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = APISite("af", "wpbeta"), code = 'af', fam = Family("wpbeta"), user = None
sysop = None
    def __init__(self, code, fam=None, user=None, sysop=None):
        """
            Initializer.
    
            @param code: the site's language code
            @type code: str
            @param fam: wiki family name (optional)
            @type fam: str or Family
            @param user: bot user name (optional)
            @type user: str
            @param sysop: sysop account user name (optional)
            @type sysop: 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(u'BaseSite: code "%s" converted to lowercase' % code)
            code = code.lower()
        if not all(x in pywikibot.family.CODE_CHARACTERS for x in str(code)):
            pywikibot.log(u'BaseSite: code "%s" contains invalid characters'
                          % code)
        self.__code = code
        if isinstance(fam, basestring) 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(u'Site %s instantiated using code %s'
                              % (self, code))
            else:
                # no such language anymore
                self.obsolete = True
                pywikibot.log(u'Site %s instantiated and marked "obsolete" '
                              u'to prevent access' % self)
        elif self.__code not in self.languages():
            if self.__family.name in list(self.__family.langs.keys()) 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(u'Global configuration variable "mylang" changed to '
                         u'"%s" while instantiating site %s'
                         % (self.__code, self), UserWarning)
            else:
                raise UnknownSite(u"Language '%s' does not exist in family %s"
>                                 % (self.__code, self.__family.name))
E               UnknownSite: Language 'af' does not exist in family wpbeta

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

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

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

Reply via email to