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-core/jobs/210337931

___________________________ TestPageObject.testLinks ___________________________

self = <tests.page_tests.TestPageObject testMethod=testLinks>

    def testLinks(self):

        """Test the different types of links from a page."""

        if self.site.family.name == 'wpbeta':

            raise unittest.SkipTest('Test fails on betawiki; T69931')

        mainpage = self.get_mainpage()

        for p in mainpage.linkedPages():

            self.assertIsInstance(p, pywikibot.Page)

>       iw = list(mainpage.interwiki(expand=True))

tests/page_tests.py:495: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pywikibot/page.py:1425: in interwiki

    if link.site != self.site:

pywikibot/page.py:5360: in site

    self.parse()

pywikibot/page.py:5266: in parse

    newsite = self._site.interwiki(prefix)

pywikibot/site.py:949: in interwiki

    return self._interwikimap[prefix].site

pywikibot/site.py:705: in __getitem__

    raise self._iw_sites[prefix].site

pywikibot/site.py:668: in site

    self._site = pywikibot.Site(url=self.url)

pywikibot/__init__.py:854: in Site

    code = family.from_url(url)

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Family("wsbeta"), url = 'https://wikisource.org/wiki/$1'

    def from_url(self, url):

        """

            Return whether this family matches the given url.

    

            It is first checking if a domain of this family is in the the domain of

            the URL. If that is the case it's checking all codes and verifies that

            a path generated via L{APISite.article_path} and L{Family.path} matches

            the path of the URL together with the hostname for that code.

    

            It is using L{Family.domains} to first check if a domain applies and

            then iterates over L{Family.codes} to actually determine which code

            applies.

    

            @param url: the URL which may contain a C{$1}. If it's missing it is

                assumed to be at the end and if it's present nothing is allowed

                after it.

            @type url: str

            @return: The language code of the url. None if that url is not from

                this family.

            @rtype: str or None

            @raises RuntimeError: When there are multiple languages in this family

                which would work with the given URL.

            @raises ValueError: When text is present after $1.

            """

        if self._ignore_from_url is True:

            return None

        else:

            ignored = self._ignore_from_url

    

        parsed = urlparse.urlparse(url)

        if not re.match('^(https?)?$', parsed.scheme):

            return None

        path = parsed.path

        if parsed.query:

            path += '?' + parsed.query

    

        # Discard $1 and everything after it

        path, _, suffix = path.partition('$1')

        if suffix:

            raise ValueError('Text after the $1 placeholder is not supported '

                             '(T111513).')

    

        matched_sites = []

        for domain in self.domains:

            if domain in parsed.netloc:

                break

        else:

            domain = False

        if domain is not False:

            for code in self.codes:

                if code in ignored:

                    continue

                if self._hostname(code)[1] == parsed.netloc:

                    # Use the code and family instead of the url

                    # This is only creating a Site instance if domain matches

                    site = pywikibot.Site(code, self.name)

                    pywikibot.log('Found candidate {0}'.format(site))

    

                    if path in site._interwiki_urls():

                        matched_sites += [site]

    

        if len(matched_sites) == 1:

            return matched_sites[0].code

        elif not matched_sites:

            return None

        else:

            raise RuntimeError(

                'Found multiple matches for URL "{0}": {1}'

>               .format(url, ', '.join(str(s) for s in matched_sites)))

E           RuntimeError: Found multiple matches for URL "https://wikisource.org/wiki/$1": wsbeta:tyv, wsbeta:hak, wsbeta:bxr, wsbeta:azb, wsbeta:io, wsbeta:fur, wsbeta:bug, wsbeta:myv, wsbeta:glk, wsbeta:srn, wsbeta:ast, wsbeta:vro, wsbeta:kg, wsbeta:fiu-vro, wsbeta:nrm, wsbeta:gv, wsbeta:pdc, wsbeta:kaa, wsbeta:ba, wsbeta:rn, wsbeta:mn, wsbeta:bm, wsbeta:lij, wsbeta:ti, wsbeta:cu, wsbeta:so, wsbeta:ie, wsbeta:ng, wsbeta:lmo, wsbeta:kl, wsbeta:sn, wsbeta:fy, wsbeta:wuu, wsbeta:bat-smg, wsbeta:lg, wsbeta:lzh, wsbeta:szl, wsbeta:bjn, wsbeta:mzn, wsbeta:sc, wsbeta:ur, wsbeta:xal, wsbeta:lez, wsbeta:km, wsbeta:nov, wsbeta:kbd, wsbeta:dz, wsbeta:om, wsbeta:ckb, wsbeta:sq, wsbeta:hi, wsbeta:pms, wsbeta:ps, wsbeta:uz, wsbeta:vo, wsbeta:pcd, wsbeta:got, wsbeta:kv, wsbeta:krc, wsbeta:ii, wsbeta:lbe, wsbeta:cho, wsbeta:nds, wsbeta:map-bms, wsbeta:arc, wsbeta:cr, wsbeta:ha, wsbeta:aa, wsbeta:wo, wsbeta:pa, wsbeta:ksh, wsbeta:kw, wsbeta:sh, wsbeta:lo, wsbeta:tw, wsbeta:egl, wsbeta:vls, wsbeta:pih, wsbeta:ku, wsbeta:nn, wsbeta:tt, wsbeta:bpy, wsbeta:ch, wsbeta:rup, wsbeta:rue, wsbeta:eu, wsbeta:lrc, wsbeta:zh-classical, wsbeta:roa-tara, wsbeta:hz, wsbeta:ho, wsbeta:mus, wsbeta:sw, wsbeta:gag, wsbeta:am, wsbeta:mg, wsbeta:eml, wsbeta:tpi, wsbeta:ab, wsbeta:ny, wsbeta:tk, wsbeta:ilo, wsbeta:nap, wsbeta:ace, wsbeta:cbk-zam, wsbeta:ve, wsbeta:ss, wsbeta:tg, wsbeta:ady, wsbeta:mai, wsbeta:ay, wsbeta:iu, wsbeta:sd, wsbeta:mwl, wsbeta:qu, wsbeta:scn, wsbeta:gan, wsbeta:zh-yue, wsbeta:olo, wsbeta:frr, wsbeta:ceb, wsbeta:na, wsbeta:ak, wsbeta:ga, wsbeta:tum, wsbeta:pnb, wsbeta:frp, wsbeta:gn, wsbeta:rw, wsbeta:ik, wsbeta:yo, wsbeta:se, wsbeta:ext, wsbeta:gom, wsbeta:hif, wsbeta:cv, wsbeta:pag, wsbeta:ln, wsbeta:ka, wsbeta:sco, wsbeta:bcl, wsbeta:diq, wsbeta:koi, wsbeta:mh, wsbeta:sgs, wsbeta:oc, wsbeta:arz, wsbeta:nv, wsbeta:ug, wsbeta:dv, wsbeta:rm, wsbeta:csb, wsbeta:mdf, wsbeta:chy, wsbeta:av, wsbeta:nds-nl, wsbeta:ltg, wsbeta:ms, wsbeta:ne, wsbeta:sm, wsbeta:cdo, wsbeta:to, wsbeta:min, wsbeta:jv, wsbeta:mt, wsbeta:ff, wsbeta:jbo, wsbeta:zea, wsbeta:ts, wsbeta:wa, wsbeta:tl, wsbeta:udm, wsbeta:kk, wsbeta:mhr, wsbeta:tn, wsbeta:nso, wsbeta:lad, wsbeta:sg, wsbeta:mrj, wsbeta:af, wsbeta:haw, wsbeta:si, wsbeta:mi, wsbeta:xmf, wsbeta:gsw, wsbeta:pfl, wsbeta:rmy, wsbeta:jam, wsbeta:ky, wsbeta:ee, wsbeta:su, wsbeta:pnt, wsbeta:pi, wsbeta:nah, wsbeta:an, wsbeta:bar, wsbeta:new, wsbeta:mo, wsbeta:kj, wsbeta:ig, wsbeta:st, wsbeta:chr, wsbeta:my, wsbeta:bo, wsbeta:war, wsbeta:fj, wsbeta:gd, wsbeta:lv, wsbeta:hsb, wsbeta:pam, wsbeta:os, wsbeta:tcy, wsbeta:roa-rup, wsbeta:als, wsbeta:xh, wsbeta:tet, wsbeta:yue, wsbeta:zu, wsbeta:simple, wsbeta:bh, wsbeta:ty, wsbeta:ia, wsbeta:crh, wsbeta:ce, wsbeta:ki, wsbeta:kab, wsbeta:lb, wsbeta:co, wsbeta:bi, wsbeta:dsb, wsbeta:vep, wsbeta:pap, wsbeta:stq, wsbeta:kr, wsbeta:ks, wsbeta:za

pywikibot/family.py:1228: RuntimeError

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

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

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

Reply via email to