Page MenuHomePhabricator

archivebot_tests tests are failing
Closed, ResolvedPublic

Description

After https://gerrit.wikimedia.org/r/#/c/pywikibot/core/+/441627/ has been merged, archivebot_tests tests are failing:

=================================== FAILURES ===================================
______________________ TestArchiveBot.test_archivebot_id _______________________

self = <tests.archivebot_tests.TestArchiveBot testMethod=test_archivebot_id>

    def wrapped_method(self):
        sitedata = self.sites[key]
        self.site_key = key
        self.family = sitedata['family']
        self.code = sitedata['code']
        self.site = sitedata['site']
>       func(self, key)

tests/aspects.py:783: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/archivebot_tests.py:160: in test_archivebot
    self.assertIsInstance(thread.timestamp, datetime)
E   AssertionError: None is not an instance of <type 'datetime.datetime'>
------------------------------ Captured log call -------------------------------
logging.py                 109 VERBOSE  Found 1 wikipedia:id processes running, including this one.
logging.py                 109 INFO     code id:
______________________ TestArchiveBot.test_archivebot_scn ______________________

self = <tests.archivebot_tests.TestArchiveBot testMethod=test_archivebot_scn>

    def wrapped_method(self):
        sitedata = self.sites[key]
        self.site_key = key
        self.family = sitedata['family']
        self.code = sitedata['code']
        self.site = sitedata['site']
>       func(self, key)

tests/aspects.py:783: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/archivebot_tests.py:160: in test_archivebot
    self.assertIsInstance(thread.timestamp, datetime)
E   AssertionError: None is not an instance of <type 'datetime.datetime'>
------------------------------ Captured log call -------------------------------
logging.py                 109 VERBOSE  Found 1 wikipedia:scn processes running, including this one.
logging.py                 109 INFO     code scn: Let's kiss hands and welcome the sicilian wikipedia.<br>
Sorry but I just wrote that I thought you were a bot and was explaining to the users in sicilian language what seems like this bot does which looks like adding links to other terms and categories in different languages.<br>
If you are a human or a
____________________ TestArchiveBot.test_archivebot_zh_yue _____________________

self = <tests.archivebot_tests.TestArchiveBot testMethod=test_archivebot_zh_yue>

    def wrapped_method(self):
        sitedata = self.sites[key]
        self.site_key = key
        self.family = sitedata['family']
        self.code = sitedata['code']
        self.site = sitedata['site']
>       func(self, key)

tests/aspects.py:783: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/archivebot_tests.py:160: in test_archivebot
    self.assertIsInstance(thread.timestamp, datetime)
E   AssertionError: None is not an instance of <type 'datetime.datetime'>
------------------------------

See https://api.travis-ci.org/v3/job/403487972/log.txt for example

Event Timeline

Xqt triaged this task as High priority.Jul 13 2018, 2:14 PM

At least one of the issues is in extract_sections. It is assuming that anything after a language link belongs to the footer and does not return it as a section content and therefore that part won't be checked for existing timestamps.

that does not work in practice because users sometimes forget to use a : for their interlanguage links and that causes archive bot to render sections incorrectly.

As an example see https://scn.wikipedia.org/wiki/Discussioni_utenti:Xqt. There is a [[en:jabberwacky|jabberwacky] in the second section. Therefore the signature line won't be checked for the timestamp and the test will fail.

Change 445768 had a related patch set uploaded (by Dalba; owner: dalba):
[pywikibot/core@master] textlib.extract_sections: Not everything after a language link is footer

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

The error message is equal to that in T69663. Can we solve it at once?

Change 445772 had a related patch set uploaded (by Dalba; owner: dalba):
[pywikibot/core@master] textlib.extract_sections: Not everything after a language link is footer

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

Change 445772 abandoned by Dalba:
textlib.extract_sections: Not everything after a language link is footer

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

Change 445768 merged by jenkins-bot:
[pywikibot/core@master] textlib.extract_sections: Not everything after a language link is footer

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

This comment was removed by Dvorapa.

After the patch cosmetic changes duplicates categories: T199751