Page MenuHomePhabricator

Tests fail on Wikia
Closed, ResolvedPublic

Description

It would be good to add another farm to our test builds. We have a few Wikia already in family files, and other family classes are -2'd , so Wikia it is.

Here are the Wikia failures (using py3):

api_tests.TestParamInfo.test_new_mode

Traceback (most recent call last):
  File "./tests/api_tests.py", line 231, in test_new_mode
    pi.fetch(['info'])
  File "./pywikibot/data/api.py", line 268, in fetch
    self._init()
  File "./pywikibot/data/api.py", line 202, in _init
    main_modules_param = self.parameter('main', 'action')
  File "./pywikibot/data/api.py", line 379, in parameter
    self.fetch(set([module]))
  File "./pywikibot/data/api.py", line 281, in fetch
    assert(self._query_modules or _init)
AssertionError

site_tests.TestSiteTokens.test_tokens_in_mw_119

Traceback (most recent call last):
  File "./tests/site_tests.py", line 1239, in test_tokens_in_mw_119
    self._test_tokens(None, '1.19', 'edit', 'delete')
  File "./tests/site_tests.py", line 1235, in _test_tokens
    self.assertIn(in_tested, self.mysite.tokens)
AssertionError: 'edit' not found in {'Jayvdb': {}}

site_tests.TestSiteObjectDeprecatedFunctions.test_token

Traceback (most recent call last):
  File "./tests/site_tests.py", line 57, in test_token
    token = mysite.tokens[ttype]
  File "./pywikibot/site.py", line 1341, in __getitem__
    .format(key, self.site.user(), self.site))
pywikibot.exceptions.Error: Action 'edit' is not allowed for user Jayvdb on wikia:wikia wiki.

site_tests.SiteUserTestCase.testSearch

Traceback (most recent call last):
  File "./tests/site_tests.py", line 887, in testSearch
    se = list(mysite.search("wiki", total=100))
  File "./pywikibot/data/api.py", line 1452, in __iter__
    self.data = self.request.submit()
  File "./pywikibot/data/api.py", line 1071, in submit
    raise APIError(code, info, **result["error"])
pywikibot.data.api.APIError: gsrsearch-text-disabled: text search is disabled

site_tests.SiteUserTestCase2.testPatrol

Traceback (most recent call last):
  File "./pywikibot/site.py", line 1323, in __getitem__
    key = self.site.validate_tokens([key])[0]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./tests/site_tests.py", line 1155, in testPatrol
    result = list(mysite.patrol(rcid=rc['rcid']))
  File "./pywikibot/site.py", line 4232, in patrol
    token = self.tokens['patrol']
  File "./pywikibot/site.py", line 1327, in __getitem__
    .format(key, self.site))
pywikibot.exceptions.Error: Requested token 'patrol' is invalid on wikia:wikia wiki.

page_tests.TestPageObject.testLinks

Traceback (most recent call last):
  File "./tests/page_tests.py", line 461, in testLinks
    iw = list(mainpage.interwiki(expand=True))
  File "./pywikibot/page.py", line 1150, in interwiki
    text = self.expand_text()
  File "./pywikibot/tools.py", line 647, in wrapper
    return obj(*__args, **__kw)
  File "./pywikibot/page.py", line 499, in expand_text
    includecomments=includecomments)
  File "./pywikibot/site.py", line 992, in callee
    return fn(self, *args, **kwargs)
  File "./pywikibot/site.py", line 1958, in expand_text
    return req.submit()['expandtemplates'][key]
  File "./pywikibot/data/api.py", line 1213, in submit
    self._data = super(CachedRequest, self).submit()
  File "./pywikibot/data/api.py", line 1071, in submit
    raise APIError(code, info, **result["error"])
pywikibot.data.api.APIError: notext: The text parameter must be set

wikibase_tests.TestPageMethods.test_item_templates

Traceback (most recent call last):
  File "./tests/wikibase_tests.py", line 554, in test_item_templates
    self.wdp.templatesWithParams()
  File "./pywikibot/tools.py", line 647, in wrapper
    return obj(*__args, **__kw)
  File "./pywikibot/page.py", line 1288, in templatesWithParams
    templates = textlib.extract_templates_and_params(self.text)
  File "./pywikibot/textlib.py", line 973, in extract_templates_and_params
    return extract_templates_and_params_regex(text)
  File "./pywikibot/textlib.py", line 1000, in extract_templates_and_params_regex
    thistxt = removeDisabledParts(text)
  File "./pywikibot/textlib.py", line 327, in removeDisabledParts
    return toRemoveR.sub('', text)
TypeError: expected string or buffer

(this one is unrelated I believe.. but I thought we fixed this??)

Many of these require the test suite to be a bit more intelligent about user rights.


Version: core-(2.0)
Severity: normal

Details

Reference
bz73513

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:48 AM
bzimport added a project: Pywikibot-tests.
bzimport set Reference to bz73513.
bzimport added a subscriber: Unknown Object (????).
jayvdb created this task.Nov 17 2014, 1:07 PM

(In reply to John Mark Vandenberg from comment #0)

It would be good to add another farm to our test builds. We have a few
Wikia already in family files, and other family classes are -2'd , so Wikia
it is.

Wikia is currently 1.19.20

Here are the Wikia failures (using py3):

api_tests.TestParamInfo.test_new_mode

Traceback (most recent call last):

File "./tests/api_tests.py", line 231, in test_new_mode
  pi.fetch(['info'])
File "./pywikibot/data/api.py", line 268, in fetch
  self._init()
File "./pywikibot/data/api.py", line 202, in _init
  main_modules_param = self.parameter('main', 'action')
File "./pywikibot/data/api.py", line 379, in parameter
  self.fetch(set([module]))
File "./pywikibot/data/api.py", line 281, in fetch
  assert(self._query_modules or _init)

v1.19 doesnt support the new mode; e.g.

http://www.wikia.com/api.php?format=jsonfm&modules=query+siteinfo&action=paraminfo

Im not sure which version it was added

site_tests.TestSiteTokens.test_tokens_in_mw_119

Traceback (most recent call last):

File "./tests/site_tests.py", line 1239, in test_tokens_in_mw_119
  self._test_tokens(None, '1.19', 'edit', 'delete')
File "./tests/site_tests.py", line 1235, in _test_tokens
  self.assertIn(in_tested, self.mysite.tokens)

AssertionError: 'edit' not found in {'Jayvdb': {}}

not high priority; need to skip this test if user doesnt have edit. Or add can-edit to the 'user = True' aspects flag.

site_tests.TestSiteObjectDeprecatedFunctions.test_token

Traceback (most recent call last):

File "./tests/site_tests.py", line 57, in test_token
  token = mysite.tokens[ttype]
File "./pywikibot/site.py", line 1341, in __getitem__
  .format(key, self.site.user(), self.site))

pywikibot.exceptions.Error: Action 'edit' is not allowed for user Jayvdb on
wikia:wikia wiki.

as above

site_tests.SiteUserTestCase.testSearch

Traceback (most recent call last):

File "./tests/site_tests.py", line 887, in testSearch
  se = list(mysite.search("wiki", total=100))
File "./pywikibot/data/api.py", line 1452, in __iter__
  self.data = self.request.submit()
File "./pywikibot/data/api.py", line 1071, in submit
  raise APIError(code, info, **result["error"])

pywikibot.data.api.APIError: gsrsearch-text-disabled: text search is disabled

This should be detected and become a skiptest

site_tests.SiteUserTestCase2.testPatrol

Traceback (most recent call last):

File "./pywikibot/site.py", line 1323, in __getitem__
  key = self.site.validate_tokens([key])[0]

IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "./tests/site_tests.py", line 1155, in testPatrol
  result = list(mysite.patrol(rcid=rc['rcid']))
File "./pywikibot/site.py", line 4232, in patrol
  token = self.tokens['patrol']
File "./pywikibot/site.py", line 1327, in __getitem__
  .format(key, self.site))

pywikibot.exceptions.Error: Requested token 'patrol' is invalid on
wikia:wikia wiki.

testPatrol should check it can get a patrol token, and skip test if not

page_tests.TestPageObject.testLinks

Traceback (most recent call last):

File "./tests/page_tests.py", line 461, in testLinks
  iw = list(mainpage.interwiki(expand=True))
File "./pywikibot/page.py", line 1150, in interwiki
  text = self.expand_text()
File "./pywikibot/tools.py", line 647, in wrapper
  return obj(*__args, **__kw)
File "./pywikibot/page.py", line 499, in expand_text
  includecomments=includecomments)
File "./pywikibot/site.py", line 992, in callee
  return fn(self, *args, **kwargs)
File "./pywikibot/site.py", line 1958, in expand_text
  return req.submit()['expandtemplates'][key]
File "./pywikibot/data/api.py", line 1213, in submit
  self._data = super(CachedRequest, self).submit()
File "./pywikibot/data/api.py", line 1071, in submit
  raise APIError(code, info, **result["error"])

pywikibot.data.api.APIError: notext: The text parameter must be set

Both Page and Site methods should avoid expanding templates for the empty string.

wikibase_tests.TestPageMethods.test_item_templates

Traceback (most recent call last):

File "./tests/wikibase_tests.py", line 554, in test_item_templates
  self.wdp.templatesWithParams()
File "./pywikibot/tools.py", line 647, in wrapper
  return obj(*__args, **__kw)
File "./pywikibot/page.py", line 1288, in templatesWithParams
  templates = textlib.extract_templates_and_params(self.text)
File "./pywikibot/textlib.py", line 973, in extract_templates_and_params
  return extract_templates_and_params_regex(text)
File "./pywikibot/textlib.py", line 1000, in

extract_templates_and_params_regex

  thistxt = removeDisabledParts(text)
File "./pywikibot/textlib.py", line 327, in removeDisabledParts
  return toRemoveR.sub('', text)

TypeError: expected string or buffer

(this one is unrelated I believe.. but I thought we fixed this??)

Many of these require the test suite to be a bit more intelligent about user
rights.

jayvdb moved this task from Backlog to Test failures on the Pywikibot-tests board.Nov 29 2014, 4:56 PM
XZise added a subscriber: XZise.Nov 30 2014, 10:48 AM

wikibase_tests.TestPageMethods.test_item_templates

Traceback (most recent call last):

File "./tests/wikibase_tests.py", line 554, in test_item_templates
  self.wdp.templatesWithParams()
File "./pywikibot/tools.py", line 647, in wrapper
  return obj(*__args, **__kw)
File "./pywikibot/page.py", line 1288, in templatesWithParams
  templates = textlib.extract_templates_and_params(self.text)
File "./pywikibot/textlib.py", line 973, in extract_templates_and_params
  return extract_templates_and_params_regex(text)
File "./pywikibot/textlib.py", line 1000, in

extract_templates_and_params_regex

  thistxt = removeDisabledParts(text)
File "./pywikibot/textlib.py", line 327, in removeDisabledParts
  return toRemoveR.sub('', text)

TypeError: expected string or buffer

(this one is unrelated I believe.. but I thought we fixed this??)

Indeed this looks like T71664, but in this case the test is directly calling templatesWithParams on an ItemPage which itself calls textlib.extract_templates_and_params and T71664 just prevented that botMayEdit calls that templatesWithParams. But in theory this should happen anywhere and not just with Wikia.

A possible solution would be to override templatesWithParams in ItemPage to always return an empty list.

Indeed this looks like T71664, but in this case the test is directly calling templatesWithParams on an ItemPage which itself calls textlib.extract_templates_and_params and T71664 just prevented that botMayEdit calls that templatesWithParams. But in theory this should happen anywhere and not just with Wikia.

A possible solution would be to override templatesWithParams in ItemPage to always return an empty list.

Hmm, I'd be more inclined to raise an exception, as anyone calling ItemPage.templatesWithParams is using the wrong method with the wrong type of page, and the code needs to be fixed.

Omegat added a subscriber: Omegat.Dec 8 2014, 4:13 AM
jayvdb updated the task description. (Show Details)Dec 9 2014, 8:53 AM
jayvdb set Security to None.
jayvdb removed a subscriber: Unknown Object (????).
XZise added a comment.Dec 27 2014, 7:33 PM

It appears that page_tests.TestPageObject.testLinks has been fixed as part of T75529. Although the question is why the main page has no text at all (so maybe the symptom is gone but not the cause).

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 21 2015, 6:39 AM

Change 226039 had a related patch set uploaded (by John Vandenberg):
Add Wikia to travis build matrix

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

Change 226039 merged by jenkins-bot:
Add Wikia to travis build matrix

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

XZise closed this task as Resolved.Jul 21 2015, 4:23 PM
XZise assigned this task to jayvdb.
XZise removed a project: Patch-For-Review.
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptFeb 25 2016, 5:06 AM