Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944234 )

Change subject: [cleanup] Remove mw_version check in api.Request._add_defaults
......................................................................

[cleanup] Remove mw_version check in api.Request._add_defaults

Python 8 supports mw 1.27 only; therefore remove the mw check.
This leads that site.version() is no longer called and the
error messages aren't printed. Update tests accordingly.

Bug: T306637
Change-Id: Ie91e5120931b757123659d2cc457f2d8a7413b06
---
M pywikibot/data/api/_requests.py
M tests/api_tests.py
2 files changed, 18 insertions(+), 11 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index ee19e54..7e7758c 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -438,8 +438,7 @@
             # dummy rawcontinue parameter except for 'tokens' (T284577) and
             # 'siteinfo' (T343204)
             if ('tokens' not in meta and 'siteinfo' not in meta
-                and 'continue' not in self._params
-                    and self.site.mw_version >= '1.25wmf5'):
+                    and 'continue' not in self._params):
                 self._params.setdefault('rawcontinue', [''])

         elif self.action == 'help':
diff --git a/tests/api_tests.py b/tests/api_tests.py
index 783e1b5..dbffb21 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -856,8 +856,7 @@

     @patch.object(pywikibot, 'info')
     @patch.object(pywikibot, 'warning')
-    @patch.object(pywikibot, 'error')
-    def test_access_denied_notexist_username(self, error, warning, output):
+    def test_access_denied_notexist_username(self, warning, info):
         """Test the query with a username which does not exist."""
         self.site._username = 'Not registered username'
         req = api.Request(site=self.site, parameters={'action': 'query'})
@@ -869,10 +868,8 @@
         warning.assert_called_with(
             'API error readapidenied: '
             'You need read permission to use this module.')
-        error.assert_called_with(
-            'You have no API read permissions. Seems you are not logged in.')
         self.assertIn(
-            'Logging in to steward:steward as ', output.call_args[0][0])
+            'Logging in to steward:steward as ', info.call_args[0][0])

 
 class TestLazyLoginNoUsername(TestLazyLoginBase):
@@ -880,9 +877,8 @@
     """Test no username."""

     @patch.object(pywikibot, 'warning')
-    @patch.object(pywikibot, 'error')
     @patch.object(pywikibot.config, 'usernames', defaultdict(dict))
-    def test_access_denied_no_username(self, error, warning):
+    def test_access_denied_no_username(self, warning):
         """Test the query without a username."""
         self.site._username = None
         req = api.Request(site=self.site, parameters={'action': 'query'})
@@ -894,8 +890,6 @@
         warning.assert_called_with(
             'API error readapidenied: '
             'You need read permission to use this module.')
-        error.assert_called_with(
-            'You have no API read permissions. Seems you are not logged in.')


 class TestUrlEncoding(TestCase):

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/944234
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie91e5120931b757123659d2cc457f2d8a7413b06
Gerrit-Change-Number: 944234
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to