jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] Archive unsigned threads using timestamp of the next thread

Also update tests

Bug: T182685
Bug: T69663
Change-Id: Ib23632ad396ab918f4eff695b93ab80c037b06f9
---
M scripts/archivebot.py
M tests/archivebot_tests.py
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index a756bbd..d431371 100755
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -389,6 +389,11 @@
cur_thread.feed_line(line)
self.threads.append(cur_thread)

+ # add latter timestamp to predecessor if it is None
+ for last, prev in pairwise(reversed(self.threads)):
+ if not prev.timestamp:
+ prev.timestamp = last.timestamp
+
if self.keep:
# set the timestamp to the previous if the current is lower
for first, second in pairwise(self.threads):
diff --git a/tests/archivebot_tests.py b/tests/archivebot_tests.py
index fd7831d..0a7bbf5 100755
--- a/tests/archivebot_tests.py
+++ b/tests/archivebot_tests.py
@@ -112,6 +112,7 @@
sites = {code: {'family': 'wikipedia', 'code': code} for code in THREADS}

cached = True
+ expected_failures = ['ar', 'scn', 'th']

def test_archivebot(self, code=None):
"""Test archivebot for one site."""
@@ -142,7 +143,6 @@
self.assertIsInstance(thread.content, str)
self.assertIsInstance(thread.timestamp, datetime)

- expected_failures = ['ar', 'eo', 'pdc', 'scn', 'th']
# FIXME: see TestArchiveBotAfterDateUpdate()
# 'ar': Uses Arabic acronym for TZ
# 'eo': changed month name setting in wiki from Sep to sep

To view, visit change 820477. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ib23632ad396ab918f4eff695b93ab80c037b06f9
Gerrit-Change-Number: 820477
Gerrit-PatchSet: 5
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged