Page MenuHomePhabricator

several tests fails with abstract wiki
Closed, ResolvedPublicBUG REPORT

Description

======================================================================
ERROR: testLinks (tests.page_tests.TestPageObject)
Test the different types of links from a page.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\pywikibot\pywikibot\tests\page_tests.py", line 547, in testLinks
    for p in mainpage.langlinks():
  File "D:\a\pywikibot\pywikibot\pywikibot\page\_basepage.py", line 1619, in langlinks
    self._langlinks = set(self.iterlanglinks(include_obsolete=True))
  File "D:\a\pywikibot\pywikibot\pywikibot\site\_generators.py", line 907, in pagelanglinks
    link = pywikibot.Link.langlinkUnsafe(linkdata['lang'],
  File "D:\a\pywikibot\pywikibot\pywikibot\page\_links.py", line 592, in langlinkUnsafe
    link._site = pywikibot.Site(lang, source.family.name)
  File "D:\a\pywikibot\pywikibot\pywikibot\__init__.py", line 266, in Site
    _sites[key] = interface(code=code, fam=fam, user=user)
  File "D:\a\pywikibot\pywikibot\pywikibot\site\_apisite.py", line 127, in __init__
    super().__init__(code, fam, user)
  File "D:\a\pywikibot\pywikibot\pywikibot\site\_basesite.py", line 120, in __init__
    raise UnknownSiteError(error_msg)
pywikibot.exceptions.UnknownSiteError: Language 'abstract' does not exist in family wikipedia

======================================================================
ERROR: test_pagelanglinks (tests.site_generators_tests.TestSiteGenerators)
Test Site.pagelanglinks.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\pywikibot\pywikibot\tests\site_generators_tests.py", line 211, in test_pagelanglinks
    for ll in self.site.pagelanglinks(self.mainpage):
  File "D:\a\pywikibot\pywikibot\pywikibot\site\_generators.py", line 907, in pagelanglinks
    link = pywikibot.Link.langlinkUnsafe(linkdata['lang'],
  File "D:\a\pywikibot\pywikibot\pywikibot\page\_links.py", line 592, in langlinkUnsafe
    link._site = pywikibot.Site(lang, source.family.name)
  File "D:\a\pywikibot\pywikibot\pywikibot\__init__.py", line 266, in Site
    _sites[key] = interface(code=code, fam=fam, user=user)
  File "D:\a\pywikibot\pywikibot\pywikibot\site\_apisite.py", line 127, in __init__
    super().__init__(code, fam, user)
  File "D:\a\pywikibot\pywikibot\pywikibot\site\_basesite.py", line 120, in __init__
    raise UnknownSiteError(error_msg)
pywikibot.exceptions.UnknownSiteError: Language 'abstract' does not exist in family wikipedia

abstract wiki was implemented in T420636 having its own family file.

Event Timeline

Xqt triaged this task as High priority.Apr 6 2026, 11:43 AM

Two questions come to mind immediately:

  • How are these tests run? They don't show up for me when running tox.
  • How did these tests start failing now, but passed CI when the patch was written?
Xqt changed the task status from Open to In Progress.Apr 6 2026, 2:18 PM
Xqt claimed this task.

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

[pywikibot/core@master] Site(): redirect explicit abstract wikipedia to abstract family

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

Two questions come to mind immediately:

  • How are these tests run? They don't show up for me when running tox.
  • How did these tests start failing now, but passed CI when the patch was written?

These tests run on GitHub Actions, not on Jenkins. On GitHub, some tests are executed against live wikis, whereas Jenkins test only runs a subset of tests, mostly against the testwiki. That’s why these tests may not appear in Jenkins CI tests. The GitHub action matrix can be found on GitHub action workflows.

You can run test locally like
py -3.13 -m pwb -code:en page_tests -v TestPageObject.testLinks where
pwb is the Pywikibot wrapper to allow global options like -code
-code sets the default site for tests which is en-wiki here instead of tests-wiki
page_tests is the test file
TestPageObject is the test class if you don't want run all tests of a test file
testLinks is a test method of the given class if you don't want to run all methods of a class

See also:
https://doc.wikimedia.org/pywikibot/master/tests_ref/index.html

Xqt changed the subtype of this task from "Task" to "Bug Report".Apr 6 2026, 3:12 PM

Change #1268224 merged by jenkins-bot:

[pywikibot/core@master] Site(): redirect explicit abstract wikipedia to abstract family

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