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

TASK DESCRIPTION

https://travis-ci.org/wikimedia/pywikibot-core/jobs/264090413#L4503

______________________ TestAPIMWException.test_API_error _______________________

self = <tests.api_tests.TestAPIMWException testMethod=test_API_error>

    def test_API_error(self):

        """Test a static request."""

        req = api.Request(site=self.site, parameters={'action': 'query',

                                                      'fake': True})

        with PatchedHttp(api, self.data):

>           self.assertRaises(api.APIMWException, req.submit)

tests/api_tests.py:88: 

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

pywikibot/data/api.py:1905: in submit

    self._add_defaults()

pywikibot/data/api.py:1708: in _add_defaults

    MediaWikiVersion(self.site.version()) >= MediaWikiVersion('1.25wmf5')):

pywikibot/site.py:2744: in version

    version = self.family.version(self.code)

pywikibot/tools/__init__.py:1337: in wrapper

    return obj(*args, **kwargs)

pywikibot/family.py:1274: in version

    '{{MW stable release number}}')

pywikibot/site.py:1356: in callee

    if MediaWikiVersion(self.version()) < MediaWikiVersion(version):

pywikibot/site.py:2744: in version

    version = self.family.version(self.code)

pywikibot/tools/__init__.py:1337: in wrapper

    return obj(*args, **kwargs)

pywikibot/family.py:1274: in version

    '{{MW stable release number}}')

pywikibot/site.py:1356: in callee

    if MediaWikiVersion(self.version()) < MediaWikiVersion(version):

E   RuntimeError: maximum recursion depth exceeded in cmp

!!! Recursion detected (same locals & position)

It has occurred after https://gerrit.wikimedia.org/r/#/c/368192/ .

The test is applying PatchedHttp on the api such that any API request will always raise an APIMWException.

  1. When the API request is called, a version test is performed within Request._add_defaults.
  2. site.version tries to contact the site and sees the exception. It falls back to family.version
  3. family.version relies on site.expand_text.
  4. expand_text is decorated with need_version("1.12"), i.e. relies on site.version. (back to step 2)

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

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

To: Dalba
Cc: Aklapper, pywikibot-bugs-list, Dalba
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to