Page MenuHomePhabricator

page_tests.TestPageObject.testLinks fails for en-wiki
Closed, ResolvedPublicBUG REPORT

Description

What happens?:

page_tests.TestPageObject.testLinks fails for en-wiki on github action CI test

======================================================================
ERROR: testLinks (tests.page_tests.TestPageObject)
Test the different types of links from a page.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/pywikibot/pywikibot/tests/page_tests.py", line 534, in testLinks
    iw = list(mainpage.interwiki(expand=True))
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/page/__init__.py", line 1381, in interwiki
    if link.site != self.site:
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/page/__init__.py", line 5449, in site
    self.parse()
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/page/__init__.py", line 5352, in parse
    newsite = self._site.interwiki(prefix)
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/site/_apisite.py", line 141, in interwiki
    return self._interwikimap[prefix].site
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/site/_interwikimap.py", line 78, in __getitem__
    raise self._iw_sites[prefix].site
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/site/_interwikimap.py", line 26, in site
    url=self.url, fam=None if self.local else self.prefix)
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/__init__.py", line 1184, in Site
    code, fam = _code_fam_from_url(url, fam)
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/__init__.py", line 1097, in _code_fam_from_url
    code = family.from_url(url)
  File "/home/runner/work/pywikibot/pywikibot/pywikibot/family.py", line 858, in from_url
    'not supported (T111513).'.format(url, suffix))
ValueError: Url: https://lists.wikimedia.org/postorius/lists/$1.lists.wikimedia.org/
Text .lists.wikimedia.org/ after the $1 placeholder is not supported (T111513).

https://github.com/wikimedia/pywikibot/runs/4585427682?check_suite_focus=true

but it works locally:

C:\pwb\GIT\core>pwb -lang:en page_tests -v TestPageObject.testLinks
tests: max_retries reduced from 15 to 1
testLinks (__main__.TestPageObject)
Test the different types of links from a page. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.003s

OK

C:\pwb\GIT\core>

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:
Pywikibot 7.0.0.dev0

Event Timeline

Xqt triaged this task as High priority.Dec 21 2021, 9:47 AM

I think we should give up T111513 restriction, force the placeholder $1 (or any other format placeholder) with article_path and replace variants instead of appending the titles.

Change 749160 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Allow title placeholder $1 in the middle of an url

https://gerrit.wikimedia.org/r/749160

Change 749160 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Allow title placeholder $1 in the middle of an url

https://gerrit.wikimedia.org/r/749160