Page MenuHomePhabricator

NoUsername: ERROR: Username for wikisource:fr is undefined.
Closed, DuplicatePublic

Description

======================================================================
ERROR: test_page_gen_frws (tests.proofreadpage_tests.TestIndexPageMappings)
Test Index page generator on wikisource:fr
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/wikimedia/pywikibot-core/tests/aspects.py", line 697, in wrapped_method
    func(self, key)
  File "/home/travis/build/wikimedia/pywikibot-core/tests/proofreadpage_tests.py", line 555, in test_page_gen
    self.assertRaises(ValueError, index_page.page_gen, -1, 2)
  File "/opt/python/2.7.9/lib/python2.7/unittest/case.py", line 473, in assertRaises
    callableObj(*args, **kwargs)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/proofreadpage.py", line 662, in page_gen
    % (start, end, 1, self.num_pages))
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/proofreadpage.py", line 504, in wrapper
    self._get_page_mappings()
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/proofreadpage.py", line 563, in _get_page_mappings
    self.purge()
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/page.py", line 1338, in purge
    return self.site.purgepages([self], **kwargs)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/site.py", line 1325, in callee
    self.login(False)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/site.py", line 2081, in login
    user=self._username[sysop])
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/tools/__init__.py", line 1447, in wrapper
    return obj(*__args, **__kw)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/login.py", line 124, in __init__
    'wiki_code': self.site.code})
NoUsername: ERROR: Username for wikisource:fr is undefined.
If you have an account for that site, please add a line to user-config.py:
usernames['wikisource']['fr'] = 'myUsername'

see: https://travis-ci.org/wikimedia/pywikibot-core/jobs/183627628#L4486-L4628

Event Timeline

Problem occurs only for fr.wikisource and for 5 tests:

  • test_check_if_cached
  • test_get_labels
  • test_get_page_and_number
  • test_num_pages
  • test_page_gen

For some reason all attrs from pages links on Index:Segard - Hymnes profanes, 1894.djvu disappeared. For that reason this if-statement in end as True and PWB is trying to purge all caches including this one on server, and it looks, that such activity requires logged user.

It looks like day ago it wasn't failing (see: https://travis-ci.org/wikimedia/pywikibot-core/jobs/183282437). The question is what's the difference between these builds?

Purge requires POST in the newest MW version. IIRC pywikibot tries GET and if it gets mustpost it tries to log in to get around it.

I actually have inspect above 2000 Travis builds (ending on #1261, which was run 2 year ago) and have found NoUsername: ERROR: Username for wikisource only in 4 builds, that were run recently:

failing buildbuild timefailing jobsfailing wikisourcefailing indexlast edit time
#37562016-12-13T16:51:19Z2, 4, 6, 8, 10frLivre:Segard - Hymnes profanes, 1894.djvu18:51, 23 December 2013
#37552016-12-13T02:33:49Z2, 4, 6, 8, 10frLivre:Segard - Hymnes profanes, 1894.djvu18:51, 23 December 2013
#37332016-11-29T19:18:22Z2, 4, 6enIndex:Popular Science Monthly Volume 1.djvu14:41, 29 February 2016‎
#37322016-11-29T02:03:59Z2, 4, 6, 8, 10enIndex:Popular Science Monthly Volume 1.djvu14:41, 29 February 2016‎

I will try to check MW version changes over this period of time, but it looks that we are still missing something here (as table prove that it's not dependend on PWB source code and version of index available on wikisources).

It occurs that MW version is the same on en.wikisource and fr.wikisource. There is a problem to determine Proofread version there, but I found that there was one particular change between passing and failing tests on fr.wikisource.

I'm still loooking for some indicators on en.wikisource...

Thx for investigating. Fwiw, you may find my travis_log_fetch Python
package useful. I built it for times when I had to do the same.

LOL, I've just found T114318. It looks exactly like an issue here. We could test if null edit will resolve issuse here, but should found more generic solution.

Change 327777 had a related patch set uploaded (by Mpaa):
Fix proofreadpage.purge()

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

Change 327777 merged by jenkins-bot:
proofreadpage.py: fix IndexPage.purge()

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