Page MenuHomePhabricator

TestDeletionBotWrite.test_delete() of deletionbot_tests fails with TypeError
Closed, ResolvedPublic

Description

TestDeletionBotWrite.test_delete() of deletionbot_tests fails with TypeError undelete() got an unexpected keyword argument 'revision'

In BasePage.undelete() the keyword passed to APISite.undelete() must be 'revisions' instead of 'revision'. This bug was introduced with release 6.1 (PWBC65d49c0)

=================================== FAILURES ===================================
_______________________ TestDeletionBotWrite.test_delete _______________________

self = <tests.deletionbot_tests.TestDeletionBotWrite testMethod=test_delete>

    def test_delete(self):
        """Test deletionbot on the test wiki."""
        site = self.get_site()
        cat = pywikibot.Category(site, 'Pywikibot Delete Test')
        delete.main('-cat:Pywikibot_Delete_Test', '-always')
        self.assertIsEmpty(list(cat.members()))
        delete.main('-page:User:Unicodesnowman/DeleteTest1', '-always',
>                   '-undelete', '-summary=pywikibot unit tests')

tests/deletionbot_tests.py:36: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
scripts/delete.py:292: in main
    bot.run()
pywikibot/bot.py:1561: in run
    self.treat(page)
pywikibot/bot.py:1814: in treat
    self.treat_page()
scripts/delete.py:195: in treat_page
    self.current_page.undelete(self.summary)
pywikibot/page/_basepage.py:2122: in undelete
    self.site.undelete(self, reason, revision=undelete_revs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = APISite("test", "wikipedia")
args = (PageWithRefs('User:Unicodesnowman/DeleteTest1'), '')
kwargs = {'revision': []}

    def callee(self, *args, **kwargs):
        if self.obsolete:
            if not self.has_group('steward'):
                raise UserRightsError(CLOSED_WIKI_MSG.format(site=self))
    
        elif right is not None and not self.has_right(right):
            if os.environ.get('PYWIKIBOT_TEST_RUNNING', '0') == '1':
                rights = ' but:\n' + fill(
                    str(sorted(self.userinfo['rights'])),
                    width=76, break_on_hyphens=False)
            else:
                rights = '.'
            raise UserRightsError(
                f'User "{self.user()}" does not have required user right '
                f'"{right}" on site {self}{rights}')
>       return fn(self, *args, **kwargs)
E       TypeError: undelete() got an unexpected keyword argument 'revision'

https://github.com/wikimedia/pywikibot/actions/runs/9445385569/job/26012886341