jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/571706 )
Change subject: [tests] Suppress Userwarning about already created sites ......................................................................
[tests] Suppress Userwarning about already created sites
Bug: T225594 Change-Id: Ifec58a43bcb61ae5c986720aaa1e694dbfd4d9d7 --- M tests/isbn_tests.py M tests/reflinks_tests.py 2 files changed, 11 insertions(+), 6 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/isbn_tests.py b/tests/isbn_tests.py index 361f40f..fbe0bac 100644 --- a/tests/isbn_tests.py +++ b/tests/isbn_tests.py @@ -29,6 +29,7 @@ WikibaseTestCase, ScriptMainTestCase, ) from tests.bot_tests import TWNBotTestCase +from tests.utils import empty_sites
if StdNumValidationError: AnyIsbnValidationException = (StdNumValidationError, IsbnExc) @@ -209,13 +210,15 @@
def test_isbn_format(self): """Test format using the bot and wikibase.""" - main('-page:' + self.test_page_qid, '-always', '-format') - self.assertEqual(self.setTarget_value, '0-9752298-0-X') + with empty_sites(): + main('-page:' + self.test_page_qid, '-always', '-format') + self.assertEqual(self.setTarget_value, '0-9752298-0-X')
def test_isbn_to13(self): """Test to13 using the bot and wikibase.""" - main('-page:' + self.test_page_qid, '-always', '-to13') - self.assertTrue(self.setTarget_value, '978-0975229804') + with empty_sites(): + main('-page:' + self.test_page_qid, '-always', '-to13') + self.assertTrue(self.setTarget_value, '978-0975229804')
def setTarget_dummy(self, value): diff --git a/tests/reflinks_tests.py b/tests/reflinks_tests.py index ab8c57c..b32fc12 100644 --- a/tests/reflinks_tests.py +++ b/tests/reflinks_tests.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Tests for reflinks script.""" # -# (C) Pywikibot team, 2014-2019 +# (C) Pywikibot team, 2014-2020 # # Distributed under the terms of the MIT license. # @@ -11,6 +11,7 @@
from tests import join_xml_data_path from tests.aspects import unittest, TestCase, ScriptMainTestCase +from tests.utils import empty_sites
class TestXMLPageGenerator(TestCase): @@ -146,7 +147,8 @@ """Tear down the test by undoing the bot class patch.""" ReferencesRobot.__init__ = self._original_constructor ReferencesRobot.run = self._original_run - super(TestReferencesBotConstructor, self).tearDown() + with empty_sites(): + super(TestReferencesBotConstructor, self).tearDown()
def test_xml_simple(self): """Test the generator without any narrowing."""