Page MenuHomePhabricator

KeyError: u"Log entry (renameuser) has no 'comment' key"
Closed, ResolvedPublic

Description

https://travis-ci.org/wikimedia/pywikibot/jobs/339874481#L5400

======================================================================
ERROR: test_simple_entries_dewp (tests.logentry_tests.TestSimpleLogentries)
Test those entries which don't have an extra LogEntry subclass on wikipedia:de
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/wikimedia/pywikibot/tests/aspects.py", line 786, in wrapped_method
    func(self, key)
  File "/home/travis/build/wikimedia/pywikibot/tests/logentry_tests.py", line 147, in test_simple_entries
    self._test_logevent(simple_type)
  File "/home/travis/build/wikimedia/pywikibot/tests/logentry_tests.py", line 79, in _test_logevent
    self.assertIsInstance(logentry.comment(), unicode)
  File "/home/travis/build/wikimedia/pywikibot/pywikibot/logentries.py", line 147, in comment
    return self.data['comment']
  File "/home/travis/build/wikimedia/pywikibot/pywikibot/logentries.py", line 34, in __missing__
    raise KeyError("Log entry (%s) has no '%s' key" % (self._type, key))
KeyError: u"Log entry (renameuser) has no 'comment' key"

Event Timeline

Dalba triaged this task as High priority.Feb 11 2018, 2:30 AM

https://travis-ci.org/wikimedia/pywikibot/jobs/339874487#L4452

________________ TestSimpleLogentries.test_simple_entries_dewp _________________
self = <tests.logentry_tests.TestSimpleLogentries testMethod=test_simple_entries_dewp>
    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:786: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/logentry_tests.py:147: in test_simple_entries
    self._test_logevent(simple_type)
tests/logentry_tests.py:79: in _test_logevent
    self.assertIsInstance(logentry.comment(), unicode)
pywikibot/logentries.py:147: in comment
    return self.data['comment']
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = {'timestamp': '2018-02-10T16:01:09Z', 'suppressed': '', 'logid': 104816260, 'commenthidden': '', 'actionhidden': '', 'user': 'Itti', 'type': 'renameuser', 'action': 'renameuser'}
key = 'comment'
    def __missing__(self, key):
        """Debug when the key is missing."""
        pywikibot.debug(u"API log entry received:\n" + repr(self),
                        _logger)
>       raise KeyError("Log entry (%s) has no '%s' key" % (self._type, key))
E       KeyError: "Log entry (renameuser) has no 'comment' key"

Change 409633 had a related patch set uploaded (by Dalba; owner: Dalba):
[pywikibot/core@master] TestLogentriesBase._test_logevent: Try logentry.comment() and catch KeyError

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

Change 409633 merged by jenkins-bot:
[pywikibot/core@master] TestLogentriesBase._test_logevent: Try logentry.comment() and catch KeyError

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

Dalba claimed this task.