jayvdb created this task. jayvdb added subscribers: Aklapper, pywikipedia-bugs, jayvdb. jayvdb added projects: Pywikibot-tests, Pywikibot-pagegenerators.
TASK DESCRIPTION Tests are needed for YearPageGenerator and DayPageGenerator - these should be subclasses of DefaultSiteTestCase , and run on all travis build sites (test.wikidata, en.wp, ar.wp and fr.wikt - https://travis-ci.org/wikimedia/pywikibot-core/builds), and also be tested on the production wikidata site.
It is __very__ likely that these generators will not work as expected on non-Wikipedia sites, as https://fr.wiktionary.org/wiki/2010 and https://en.wiktionary.org/wiki/2010 do not exist, and Wikidata is very different and the date module has not been updated since Wikidata was created. These tests should identify these bugs, so that they can be fixed.
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: Aklapper, jayvdb, pywikipedia-bugs
jayvdb added a project: Google-Code-in-2014. jayvdb added a comment.
http://www.google-melange.com/gci/task/view/google/gci2014/5876800144015360
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: Aklapper, jayvdb, pywikipedia-bugs
jayvdb moved this task to pywikibot on the Google-Code-in-2014 workboard.
TASK DETAIL https://phabricator.wikimedia.org/T85313
WORKBOARD https://phabricator.wikimedia.org/project/board/74/
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb Cc: Aklapper, jayvdb, pywikipedia-bugs
Unicornisaurous claimed this task. Unicornisaurous added a comment.
I am a GCI student.
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous Cc: Aklapper, jayvdb, pywikipedia-bugs
Unicornisaurous added a comment.
I wrote a basic test (not yet submitted to Gerrit) for the year page generator:
class TestYearPageGenerator(DefaultSiteTestCase):
"""Test the year page generator"""
def test_basic(self): site = self.get_site() start = 42 end = 2026
i = 0 for page in pagegenerators.YearPageGenerator(start, end, site): self.assertIsInstance(page, pywikibot.Page) self.assertEqual(date.formatYear(site.lang, start+i), page.title(asLink=False)); i += 1 self.assertEqual(start+i-1, end)
It checks that each Page instance was generated and that it has the correct title, and also that the correct number of pages were generated. I have tested it on a few of the mentioned non-Wikipedia sites without any issues, however my test does not even issue any API requests (I don't even check `.exists()`, as that takes a while for all of the years. Should I reduce the number of years I test and also test weather `.exists` returns a bool?).
This bug report suggested that it was likely these generators would not work as expected, but as I am not very familiar with pywikibot, I have no sense of how these might fail, or what else I need to test.
I also wrote a simplistic test (also not submitted to Gerrit) for the day page generator:
class TestDayPageGenerator(DefaultSiteTestCase):
"""Test the day page generator"""
def test_basic(self): site = self.get_site() fd = date.FormatDate(site) startMonth = 1 endMonth = 12
gen = pagegenerators.DayPageGenerator(startMonth, endMonth, site)
expected = [] for month in range(startMonth, endMonth + 1): for day in range(1, date.getNumberOfDaysInMonth(month) + 1): expected.append(fd(month, day))
self.assertPageTitlesEqual(gen, expected)
for page in pagegenerators.DayPageGenerator(startMonth, endMonth, site): self.assertIsInstance(page, pywikibot.Page) exists = page.exists() # this takes a long while self.assertIsInstance(exists, bool) # this takes a long while
Any advice is welcome.
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous Cc: Aklapper, jayvdb, pywikipedia-bugs
Unicornisaurous added a comment.
After some further testing, I discovered https://phabricator.wikimedia.org/T85645 on wikidata. However, it sounded like it was anticipated that I would find many more on other non-Wikipedia sites.
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous Cc: Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a project: Patch-For-Review. gerritbot added a comment.
Change 182405 had a related patch set uploaded (by Unicornisaurous): Add unit tests for YearPageGenerator and DayPageGenerator
https://gerrit.wikimedia.org/r/182405
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous, gerritbot Cc: Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 182405 merged by jenkins-bot: Add unit tests for YearPageGenerator and DayPageGenerator
https://gerrit.wikimedia.org/r/182405
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous, gerritbot Cc: Aklapper, jayvdb, pywikipedia-bugs
Unicornisaurous closed this task as "Resolved".
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous Cc: Aklapper, jayvdb, pywikipedia-bugs
jayvdb reopened this task as "Open". jayvdb added a comment.
This broke the builds
https://travis-ci.org/wikimedia/pywikibot-core/builds
(we'll need to revert if a fix cant be found quickly)
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous, jayvdb Cc: Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 182428 had a related patch set uploaded (by Unicornisaurous): Fix TestYearPageGenerator when date formats are missing
https://gerrit.wikimedia.org/r/182428
https://phabricator.wikimedia.org/tag/patch-for-review/
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous, gerritbot Cc: Aklapper, jayvdb, pywikipedia-bugs
Unicornisaurous added a comment.
I added a temporary fix which will skip the test if the language used is missing from the formats dictionary for 'YearBC'. I have tested this with language 'ar' on 'wikipedia' (same as travis ci) so it should fix it.
I will search for an existing bug for missing formats like these and create one if none exist.
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous Cc: Aklapper, jayvdb, pywikipedia-bugs
Unicornisaurous added a comment.
https://phabricator.wikimedia.org/T85681 is for the missing languages
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous Cc: Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 182428 merged by jenkins-bot: Fix TestYearPageGenerator when date formats are missing
https://gerrit.wikimedia.org/r/182428
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous, gerritbot Cc: Aklapper, jayvdb, pywikipedia-bugs
Unicornisaurous closed this task as "Resolved". Unicornisaurous added a comment.
The tests passed
TASK DETAIL https://phabricator.wikimedia.org/T85313
REPLY HANDLER ACTIONS Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Unicornisaurous Cc: Aklapper, jayvdb, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org