=================================== FAILURES =================================== ____ TestGetSDTemplateNoSysop.test_with_delete_and_non_existing_sdtemplate _____ self = <tests.redirect_bot_tests.TestGetSDTemplateNoSysop testMethod=test_with_delete_and_non_existing_sdtemplate> def test_with_delete_and_non_existing_sdtemplate(self): """Test with delete and non-exisitng sdtemplate.""" options = {'delete': True, 'sdtemplate': 'txt {{n|a}} txt'} with patch.object(Page, 'exists', new=Mock(return_value=False)): with patch.object(pywikibot, 'warning') as w: bot = RedirectRobot('broken', None, **options) > w.assert_called_once_with('No speedy deletion template "n" available.') tests/redirect_bot_tests.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _mock_self = <MagicMock name='warning' id='139843452598984'> args = ('No speedy deletion template "n" available.',), kwargs = {} self = <MagicMock name='warning' id='139843452598984'> msg = "Expected 'warning' to be called once. Called 2 times." def assert_called_once_with(_mock_self, *args, **kwargs): """assert that the mock was called exactly once and with the specified arguments.""" self = _mock_self if not self.call_count == 1: msg = ("Expected '%s' to be called once. Called %s times." % (self._mock_name or 'mock', self.call_count)) > raise AssertionError(msg) E AssertionError: Expected 'warning' to be called once. Called 2 times. /opt/python/3.4.2/lib/python3.4/unittest/mock.py:781: AssertionError ___________ TestGetSDTemplateNoSysop.test_with_delete_no_sd_no_i18n ____________ self = <tests.redirect_bot_tests.TestGetSDTemplateNoSysop testMethod=test_with_delete_no_sd_no_i18n> @patch.object(i18n, 'twhas_key', new=Mock(return_value=False)) def test_with_delete_no_sd_no_i18n(self): """Test with delete and no i18n template.""" with patch.object(pywikibot, 'warning') as w: bot = RedirectRobot('broken', None, delete=True) > w.assert_called_once_with('No speedy deletion template available.') tests/redirect_bot_tests.py:51: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _mock_self = <MagicMock name='warning' id='139843452635624'> args = ('No speedy deletion template available.',), kwargs = {} self = <MagicMock name='warning' id='139843452635624'> msg = "Expected 'warning' to be called once. Called 2 times." def assert_called_once_with(_mock_self, *args, **kwargs): """assert that the mock was called exactly once and with the specified arguments.""" self = _mock_self if not self.call_count == 1: msg = ("Expected '%s' to be called once. Called %s times." % (self._mock_name or 'mock', self.call_count)) > raise AssertionError(msg) E AssertionError: Expected 'warning' to be called once. Called 2 times.
The extra warning is:
WARNING: Site "wsbeta:en" supports wikibase at "https://wikidata.beta.wmflabs.org/w/index.php", but creation failed: Unknown URL 'https://wikidata.beta.wmflabs.org/w/index.php'..
It's due to calling of site.data_repository() method.
{ "query": { "userinfo": { "id": 383, "name": "Dalba" }, "wikibase": { "repo": { "url": { "base": "https://wikidata.beta.wmflabs.org", "scriptpath": "/w", "articlepath": "/wiki/$1" } }, "siteid": "enwikisource" } }
The https://wikidata.beta.wmflabs.org URL is correct and working.
The issue boils down to
Site(interface='DataSite', url='https://wikidata.beta.wmflabs.org/w/index.php') Traceback (most recent call last): File "<input>", line 1, in <module> File "G:\programming\python\wiki\pywikibot-core\pywikibot\__init__.py", line 877, in Site raise SiteDefinitionError("Unknown URL '{0}'.".format(url)) pywikibot.exceptions.SiteDefinitionError: Unknown URL 'https://wikidata.beta.wmflabs.org/w/index.php'.
The same call for production URL works fine.
Site(interface='DataSite', url='https://www.wikidata.org/w/index.php')
Adding the URL to wikidata_family.py seems to fix the issue:
self.langs = { 'wikidata': 'www.wikidata.org', 'test': 'test.wikidata.org', 'wikidata.beta': 'wikidata.beta.wmflabs.org', }
We can create a new family file for wikidata.beta. but it requires maintenance and there are still some issues regarding language links on beta cluster. (See T112006 and T124715)
Another option, for the time being, is to ignore the warning.