jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/699075 )
Change subject: [bugfix] Fix test deprecation suppressions ......................................................................
[bugfix] Fix test deprecation suppressions
Oops. I standardized us on using FutureWarnings in commits fd38f5d09 and f847bf2d7 but forgot to adjust our test's suppressions.
Change-Id: If169292ac7f7b1d16b071732dd53e031d91eae73 --- M tests/api_tests.py M tests/dry_api_tests.py M tests/echo_tests.py M tests/pagegenerators_tests.py M tests/site_tests.py 5 files changed, 11 insertions(+), 11 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/api_tests.py b/tests/api_tests.py index dc769c6..b703b86 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -65,7 +65,7 @@
@suppress_warnings( 'Instead of using kwargs |Both kwargs and parameters are set', - DeprecationWarning) + FutureWarning) def test_mixed_mode(self): """Test if parameters is used with kwargs.""" req1 = api.Request(site=self.site, action='test', parameters='foo') diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py index ca677b4..9b998ac 100644 --- a/tests/dry_api_tests.py +++ b/tests/dry_api_tests.py @@ -60,7 +60,7 @@ expiry=1, site=self.altsite, parameters={'action': 'query', 'meta': 'userinfo'}) # When using ** the parameters are still unicode - with suppress_warnings('Instead of using kwargs ', DeprecationWarning): + with suppress_warnings('Instead of using kwargs ', FutureWarning): self.deprecated_explicit = CachedRequest( expiry=1, site=self.basesite, action='query', meta='userinfo') self.deprecated_asterisks = CachedRequest( diff --git a/tests/echo_tests.py b/tests/echo_tests.py index 6ede4fe..af5e924 100644 --- a/tests/echo_tests.py +++ b/tests/echo_tests.py @@ -43,7 +43,7 @@ notif = Notification.fromJSON(self.get_site(), self.data) self.assertIsInstance(notif, Notification) self.assertEqual(notif.site, self.get_site()) - with suppress_warnings(category=DeprecationWarning): + with suppress_warnings(category=FutureWarning): notif_id = notif.id self.assertEqual(notif_id, self.data['id']) self.assertEqual(int(notif_id), notif.event_id) diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py index 120469c..47ae573 100644 --- a/tests/pagegenerators_tests.py +++ b/tests/pagegenerators_tests.py @@ -218,7 +218,7 @@ self.site) pageids = [page.pageid for page in gen_pages]
- with suppress_warnings(PAGES_ID_GEN_MSG, category=DeprecationWarning): + with suppress_warnings(PAGES_ID_GEN_MSG, category=FutureWarning): gen = pagegenerators.PagesFromPageidGenerator(pageids, self.site) self.assertPageTitlesEqual(gen, self.titles)
@@ -407,7 +407,7 @@
def test_RepeatingGenerator(self): """Test RepeatingGenerator.""" - with suppress_warnings(category=DeprecationWarning): + with suppress_warnings(category=FutureWarning): gen = pagegenerators.RepeatingGenerator( self.site.recentchanges, key_func=lambda x: x['revid'], @@ -1643,7 +1643,7 @@ self.skipTest('Site is not using a Wikibase repository') with suppress_warnings( 'pywikibot.pagegenerators.UnconnectedPageGenerator is ' - 'deprecated', DeprecationWarning): + 'deprecated', FutureWarning): upgen = pagegenerators.UnconnectedPageGenerator(self.site, 3) self.assertDictEqual( upgen.request._params, { @@ -1698,7 +1698,7 @@
def test_double_opposite_protocols(self): """Test LinksearchPageGenerator with two opposite protocols.""" - with suppress_warnings(LINKSEARCH_MSG, category=DeprecationWarning): + with suppress_warnings(LINKSEARCH_MSG, category=FutureWarning): with self.assertRaises(ValueError): pagegenerators.LinksearchPageGenerator( 'http://w.wiki', @@ -1707,7 +1707,7 @@
def test_double_same_protocols(self): """Test LinksearchPageGenerator with two same protocols.""" - with suppress_warnings(LINKSEARCH_MSG, category=DeprecationWarning): + with suppress_warnings(LINKSEARCH_MSG, category=FutureWarning): gen = pagegenerators.LinksearchPageGenerator('https://w.wiki', protocol='https', site=self.site, diff --git a/tests/site_tests.py b/tests/site_tests.py index f2bd76c..f3ecc14 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -280,7 +280,7 @@ mysite = self.get_site() mainpage = self.get_mainpage() with suppress_warnings('pywikibot.site._apisite.APISite.page_exists', - DeprecationWarning): + FutureWarning): self.assertIsInstance(mysite.page_exists(mainpage), bool) self.assertIsInstance(mysite.page_restrictions(mainpage), dict) self.assertIsInstance(mysite.page_can_be_edited(mainpage), bool) @@ -636,7 +636,7 @@ def test_newfiles(self): """Test the site.newfiles() method.""" my_site = self.get_site() - with suppress_warnings(category=DeprecationWarning): + with suppress_warnings(category=FutureWarning): gen = my_site.newfiles(total=10) the_list = list(gen) self.assertLessEqual(len(the_list), 10) @@ -1438,7 +1438,7 @@ self.skipTest('gsrsearch is diabled on site {}:\n{!r}' .format(mysite, e))
- @suppress_warnings("where='title' is deprecated", DeprecationWarning) + @suppress_warnings("where='title' is deprecated", FutureWarning) def test_search_where_title(self): """Test site.search() method with 'where' parameter set to title.""" search_gen = self.site.search(
pywikibot-commits@lists.wikimedia.org