Page MenuHomePhabricator

solve_disambiguation_tests are failing with AssertionError: source parameter should be either a Site or Page object
Closed, ResolvedPublic

Description

https://travis-ci.org/wikimedia/pywikibot/jobs/336514923#L4758

======================================================================
FAIL: test_get (tests.solve_disambiguation_tests.TestGettingDisambigLinks)
Test getting disambiguation links.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/wikimedia/pywikibot/tests/solve_disambiguation_tests.py", line 31, in test_get
    pywikibot.Link(self.site, 'Link1'),
  File "/home/travis/build/wikimedia/pywikibot/pywikibot/page.py", line 5364, in __init__
    "source parameter should be either a Site or Page object"
AssertionError: source parameter should be either a Site or Page object
======================================================================
FAIL: test_get_without_templates (tests.solve_disambiguation_tests.TestGettingDisambigLinks)
Test excluding links from disamb_templates.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/wikimedia/pywikibot/tests/solve_disambiguation_tests.py", line 42, in test_get_without_templates
    links = [pywikibot.Link(self.site, 'Link1')]
  File "/home/travis/build/wikimedia/pywikibot/pywikibot/page.py", line 5364, in __init__
    "source parameter should be either a Site or Page object"
AssertionError: source parameter should be either a Site or Page object

Event Timeline

Dalba triaged this task as High priority.Feb 2 2018, 12:16 PM
Dalba renamed this task from Travis builds are failing with AssertionError: source parameter should be either a Site or Page object to solve_disambiguation_tests are failing with AssertionError: source parameter should be either a Site or Page object.Feb 2 2018, 12:18 PM

Why self.site isn't a Site object? unittest library in Python is sometimes so unintuitive..

The site should be created by the DisambiguationRobot initializer. Is it?

It seems to me as if unittest correctly handles family and code into correct Site object (line 25 is OK), but DisambiguationRobot or get_disambiguation_links breaks Site or redefine Site not correctly somehow.

The first argument of pywikibot.Link should be text. The second argument is the source.

Change 407631 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix][TEST] Fix broken solve_disambiguation.py test

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

Change 407631 merged by jenkins-bot:
[pywikibot/core@master] [bugfix][TEST] Fix broken solve_disambiguation.py test

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

Change 407717 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [bugfix][TEST] Fix broken solve_disambiguation.py test

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

Change 407717 merged by jenkins-bot:
[pywikibot/core@master] [bugfix][TEST] Fix broken solve_disambiguation.py test

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

Xqt claimed this task.
Xqt added a subscriber: Xqt.