Page MenuHomePhabricator

TestProtectionBot.test_summary() of protectbot_tests fails with AssertionError
Closed, ResolvedPublic

Description

2024-06-11T18:52:04.8965553Z ________________________ TestProtectionBot.test_summary ________________________
2024-06-11T18:52:04.8966067Z 
2024-06-11T18:52:04.8966445Z self = <tests.protectbot_tests.TestProtectionBot testMethod=test_summary>
2024-06-11T18:52:04.8966999Z 
2024-06-11T18:52:04.8967150Z     def test_summary(self):
2024-06-11T18:52:04.8967703Z         """Test automatic (un)protection summary on the test wiki."""
2024-06-11T18:52:04.8968526Z         site = self.get_site()
2024-06-11T18:52:04.8969139Z         protect.main('-cat:Pywikibot Protect Test', '-always',
2024-06-11T18:52:04.8969769Z                      '-default')
2024-06-11T18:52:04.8970370Z         protect.main('-cat:Pywikibot Protect Test', '-always',
2024-06-11T18:52:04.8970987Z                      '-unprotect')
2024-06-11T18:52:04.8971611Z         protect.main('-cat:Pywikibot Protect Test', '-always',
2024-06-11T18:52:04.8972229Z                      '-default')
2024-06-11T18:52:04.8972863Z         page = pywikibot.Page(site, 'User:Sn1per/ProtectTest2')
2024-06-11T18:52:04.8973493Z         rev = list(page.revisions())
2024-06-11T18:52:04.8973963Z         self.assertEqual(
2024-06-11T18:52:04.8974345Z             rev[1].comment,
2024-06-11T18:52:04.8975000Z             'Removed protection from "[[User:Sn1per/ProtectTest2]]": Bot: '
2024-06-11T18:52:04.8975907Z             'Unprotecting all pages from category Pywikibot Protect Test')
2024-06-11T18:52:04.8976554Z         self.assertEqual(
2024-06-11T18:52:04.8976936Z             rev[0].comment,
2024-06-11T18:52:04.8977678Z >           'Protected "[[User:Sn1per/ProtectTest2]]": Bot: '
2024-06-11T18:52:04.8978504Z             'Protecting all pages from category Pywikibot Protect Test '
2024-06-11T18:52:04.8979393Z             '([Edit=Allow only administrators] (indefinite) [Move=Allow only '
2024-06-11T18:52:04.8980153Z             'administrators] (indefinite))')
2024-06-11T18:52:04.8981618Z E       AssertionError: 'Prot[98 chars]st ([Move=Allow only administrators] (indefini[46 chars]te))' != 'Prot[98 chars]st ([Edit=Allow only administrators] (indefini[46 chars]te))'
2024-06-11T18:52:04.8983037Z E       Diff is 723 characters long. Set self.maxDiff to None to see it.

Event Timeline

Xqt triaged this task as High priority.Jun 12 2024, 4:42 AM

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

[pywikibot/core@master] [tests] set maxDiff to None in TestProtectionBot.test_summary()

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

Change #1041867 merged by jenkins-bot:

[pywikibot/core@master] [tests] set maxDiff to None in TestProtectionBot.test_summary()

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

The difference is as follows:

________________________ TestProtectionBot.test_summary ________________________

self = <tests.protectbot_tests.TestProtectionBot testMethod=test_summary>

    def test_summary(self):
        """Test automatic (un)protection summary on the test wiki."""
        site = self.get_site()
        protect.main('-cat:Pywikibot Protect Test', '-always',
                     '-default')
        protect.main('-cat:Pywikibot Protect Test', '-always',
                     '-unprotect')
        protect.main('-cat:Pywikibot Protect Test', '-always',
                     '-default')
        page = pywikibot.Page(site, 'User:Sn1per/ProtectTest2')
        rev = list(page.revisions())
        self.assertEqual(
            rev[1].comment,
            'Removed protection from "[[User:Sn1per/ProtectTest2]]": Bot: '
            'Unprotecting all pages from category Pywikibot Protect Test')
    
        self.maxDiff = None
        self.assertEqual(
            rev[0].comment,
>           'Protected "[[User:Sn1per/ProtectTest2]]": Bot: '
            'Protecting all pages from category Pywikibot Protect Test '
            '([Edit=Allow only administrators] (indefinite) [Move=Allow only '
            'administrators] (indefinite))')
E       AssertionError: 'Prot[98 chars]st ([Move=Allow only administrators] (indefini[46 chars]te))' != 'Prot[98 chars]st ([Edit=Allow only administrators] (indefini[46 chars]te))'
E       - Protected "[[User:Sn1per/ProtectTest2]]": Bot: Protecting all pages from category Pywikibot Protect Test ([Move=Allow only administrators] (indefinite) [Edit=Allow only administrators] (indefinite))
E       ?                                                                                                            ^^^^                                          ^^^^
E       + Protected "[[User:Sn1per/ProtectTest2]]": Bot: Protecting all pages from category Pywikibot Protect Test ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
E       ?                                                                                                            ^^^^                                          ^^^^

The order has been changed.

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

[pywikibot/core@master] [tests] Reorder protection result

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

Change #1042244 merged by jenkins-bot:

[pywikibot/core@master] [tests] Reorder protection result

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

Reopened. Now the result is like it was before.

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

[pywikibot/core@master] [tests] Update TestProtectionBot.test_summary() test in test_protect

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

Change #1044631 merged by jenkins-bot:

[pywikibot/core@master] [tests] Update TestProtectionBot.test_summary() test in test_protect

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