Page MenuHomePhabricator

test_two/many_continuations_limited tests fails for missing pages
Closed, ResolvedPublic

Description

=================================== FAILURES ===================================
____________ TestPropertyGenerator.test_many_continuations_limited _____________

self = <tests.api_tests.TestPropertyGenerator testMethod=test_many_continuations_limited>

    def test_many_continuations_limited(self):
        """Test PropertyGenerator with many limited props."""
        mainpage = self.get_mainpage()
        links = list(self.site.pagelinks(mainpage, total=30))
        titles = [link.title(with_section=False) for link in links]
        params = {
            'rvprop': 'ids|flags|timestamp|user|comment|content',
            'titles': '|'.join(titles)}
        if self.site.mw_version >= '1.32':
            params['rvslots'] = 'main'
        gen = api.PropertyGenerator(
            site=self.site,
            prop='revisions|info|categoryinfo|langlinks|templates',
            parameters=params)
    
        # An APIError is raised if set_maximum_items is not called.
        gen.set_maximum_items(-1)  # suppress use of "rvlimit" parameter
        # Force the generator into continuation mode
        gen.set_query_increment(5)
    
        count = 0
        for pagedata in gen:
            self.assertIsInstance(pagedata, dict)
>           self.assertIn('pageid', pagedata)
E           AssertionError: 'pageid' not found in {'pagelanguagehtmlcode': 'en', 'ns': 0, 'pagelanguage': 'en', 'contentmodel': 'wikitext', 'missing': '', 'title': 'Catherine of Armagnac', 'pagelanguagedir': 'ltr'}

tests/api_tests.py:762: AssertionError
------------------------------ Captured log call -------------------------------
VERBOSE  pywiki:logging.py:101 PropertyGenerator: multiple requested query modules support limits; using the first such module 'revisions' of ['revisions', 'info', 'categoryinfo', 'langlinks', 'templates']
_____________ TestPropertyGenerator.test_two_continuations_limited _____________

self = <tests.api_tests.TestPropertyGenerator testMethod=test_two_continuations_limited>

    def test_two_continuations_limited(self):
        """Test PropertyGenerator with many limited props and continuations."""
        mainpage = self.get_mainpage()
        links = list(self.site.pagelinks(mainpage, total=30))
        titles = [link.title(with_section=False) for link in links]
        gen = api.PropertyGenerator(
            site=self.site, prop='info|categoryinfo|langlinks|templates',
            parameters={'titles': '|'.join(titles)})
        # Force the generator into continuation mode
        gen.set_query_increment(5)
    
        count = 0
        for pagedata in gen:
            self.assertIsInstance(pagedata, dict)
>           self.assertIn('pageid', pagedata)
E           AssertionError: 'pageid' not found in {'pagelanguagehtmlcode': 'en', 'ns': 0, 'pagelanguage': 'en', 'contentmodel': 'wikitext', 'missing': '', 'title': 'Catherine of Armagnac', 'pagelanguagedir': 'ltr'}

tests/api_tests.py:780: AssertionError
------------------------------ Captured log call -------------------------------
VERBOSE  pywiki:logging.py:101 PropertyGenerator: multiple requested query modules support limits; using the first such module 'langlinks' of ['info', 'categoryinfo', 'langlinks', 'templates']

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript
Xqt triaged this task as High priority.Jan 15 2021, 3:27 PM

Change 656435 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] Fix PropteryGenerator tests

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

Change 656435 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] Fix PropertyGenerator tests

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

JJMC89 assigned this task to Xqt.
JJMC89 removed a project: Patch-For-Review.