Page MenuHomePhabricator

wikibase_tests fails for wikihow or wowwiki family
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):
run for example:
C:\pwb\GIT\core>pwb -site:wikihow:en wikibase_tests -v TestWbGeoShapeNonDry.test_WbGeoShape_WbRepresentation_methods
C:\pwb\GIT\core>pwb -site:wowwiki:en wikibase_tests -v TestWbGeoShapeNonDry.test_WbGeoShape_WbRepresentation_methods

other wikibase tests fail too, see
https://github.com/xqt/pwb/runs/4400763603?check_suite_focus=true#step:6:4573

What happens?:

tests: max_retries reduced from 15 to 1
test_WbGeoShape_WbRepresentation_methods (__main__.TestWbGeoShapeNonDry)
Test inherited or extended methods from _WbRepresentation. ...

======================================================================
ERROR: test_WbGeoShape_WbRepresentation_methods (__main__.TestWbGeoShapeNonDry)
Test inherited or extended methods from _WbRepresentation.
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".\tests\wikibase_tests.py", line 647, in test_WbGeoShape_WbRepresentation_methods
    q = pywikibot.WbGeoShape(self.page)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 949, in __init__
    specifics = type(self)._get_type_specifics(site)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 1009, in _get_type_specifics
    'data_site': cls._get_data_site(site)
  File "C:\pwb\GIT\core\pywikibot\__init__.py", line 995, in _get_data_site
    return site.geo_shape_repository()
AttributeError: 'NoneType' object has no attribute 'geo_shape_repository'

----------------------------------------------------------------------
Ran 1 test in 0.750s

FAILED (errors=1)

C:\pwb\GIT\core>

What should have happened instead?:
The test should pass. The problem might be in pywikibot.init line 946 (_WbDataPage.__init__):
which either uses the given site or the default site but ignores the page's site:
site = site or Site().data_repository()
and wikihow or wowwiki has no data_repository. Probable the data_reopsitory of Page.site should be used instead of the default Site()'s data_repository

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

Event Timeline

Xqt triaged this task as High priority.Dec 3 2021, 9:28 AM

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

[pywikibot/core@master] [bugfix] use page.site.data_repository when creating a _WbDataPage

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

Xqt claimed this task.

Change 743355 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] use page.site.data_repository when creating a _WbDataPage

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