Page MenuHomePhabricator

link_tests.py fails for missleading test wiki
Closed, ResolvedPublic

Description

======================================================================
FAIL: test_fully_qualified_NS0_family (tests.link_tests.TestFullyQualifiedNoLangFamilyExplicitLinkParser)
Test ':wikidata:testwiki:Q6' on enwp is namespace 0.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\pywikibot-g4xqx\tests\link_tests.py", line 563, in test_fully_qualified_NS0_family
    self.assertEqual(link.site, self.get_site('test.wp'))
AssertionError: APISite("test", "wikipedia") != APISite("test", "test")
======================================================================
FAIL: test_fully_qualified_NS1_family (tests.link_tests.TestFullyQualifiedNoLangFamilyExplicitLinkParser)
Test ':wikidata:testwiki:Talk:Q6' on enwp is namespace 1.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\pywikibot-g4xqx\tests\link_tests.py", line 573, in test_fully_qualified_NS1_family
    self.assertEqual(link.site, self.get_site('test.wp'))
AssertionError: APISite("test", "wikipedia") != APISite("test", "test")
======================================================================
FAIL: test_fully_qualified_NS0_family (tests.link_tests.TestFullyQualifiedNoLangFamilyImplicitLinkParser)
Test 'wikidata:testwiki:Q6' on enwp is namespace 0.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\pywikibot-g4xqx\tests\link_tests.py", line 894, in test_fully_qualified_NS0_family
    self.assertEqual(link.site, pywikibot.Site('test', 'test'))
AssertionError: APISite("test", "wikipedia") != APISite("test", "test")
======================================================================
FAIL: test_fully_qualified_NS1_family (tests.link_tests.TestFullyQualifiedNoLangFamilyImplicitLinkParser)
Test 'wikidata:testwiki:Talk:Q6' on enwp is namespace 1.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\projects\pywikibot-g4xqx\tests\link_tests.py", line 904, in test_fully_qualified_NS1_family
    self.assertEqual(link.site, pywikibot.Site('test', 'test'))
AssertionError: APISite("test", "wikipedia") != APISite("test", "test")
----------------------------------------------------------------------
Ran 1785 tests in 1134.728s
FAILED (failures=4, skipped=101, expected failures=15, unexpected successes=4)

https://ci.appveyor.com/project/Ladsgroup/pywikibot-g4xqx/builds/26050296/job/14cxpuih1crrdrd3

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript
Xqt triaged this task as High priority.Jul 17 2019, 4:38 PM

As noted in rPWBCa0a45d60c79726a934d2382823f54ee986837494 there are multiple matches for test wiki which should be solved:

I found two issues with this patch:

Site('test', 'wikipedia') == Site('test', 'test') # should be True

False

Site().fromDBName('testwiki') # should not warn

WARNING: Found multiple matches for URL \ "https://test.wikipedia.org/w/index.php": \ ('test', Family("test")), ('test', Family("wikipedia")) (use first) APISite("test", "test") Note that the first issue is not introduced by this patch (it already exists on master). The cause of the mentioned issues is that we have two separate family files that contain the same site. IOW, test.wikipeida.org is defined both in test_family.py and in wikipedia_family.py. It should be removed from one of them, but that sounds like a big breaking change and requires a deprecation period. This patch is not going to get into that matter.

Bug: T225590

Change 524084 had a related patch set uploaded (by Dalba; owner: dalba):
[pywikibot/core@master] fix(BaseSite._cmpkey): compare sites by hostname

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

Change 524091 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [bugfix] ignore test_family.py if resolving family from url

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

Change 524091 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] ignore test_family.py if resolving family from url

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

Change 524084 abandoned by Dalba:
fix(BaseSite._cmpkey): compare sites by hostname

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

Change 524084 restored by Xqt:
fix(BaseSite._cmpkey): compare sites by hostname

Reason:
There are remaining tests using test, tesz

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

Change 524210 had a related patch set uploaded (by Dalba; owner: dalba):
[pywikibot/core@master] fix(test_family): deprecate test_family

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

Change 524210 merged by jenkins-bot:
[pywikibot/core@master] fix(test_family): deprecate test_family

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

Xqt claimed this task.
Xqt reassigned this task from Xqt to Dalba.

Change 524084 abandoned by Xqt:
fix(BaseSite._cmpkey): compare sites by hostname

Reason:
test_family will be removed

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