Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1101142?usp=email )

Change subject: cleanup: Drop support for MediaWiki < 1.31
......................................................................

cleanup: Drop support for MediaWiki < 1.31

Also update tests:
- use 'lobbypedia' instead of 'infogalactic' for logentries test
- remove unreachable sites from site_detect_tests

Bug: T378984
Change-Id: I9f33aa6e2ca8ebcda77b8e05ad45e62c66e24bc7
---
M pywikibot/site/_apisite.py
M pywikibot/site_detect.py
M pywikibot/tools/__init__.py
M tests/logentries_tests.py
M tests/site_detect_tests.py
5 files changed, 25 insertions(+), 24 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index f538551..089adee 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -51,7 +51,7 @@
     UnknownExtensionError,
 )
 from pywikibot.site._basesite import BaseSite
-from pywikibot.site._decorators import need_right, need_version
+from pywikibot.site._decorators import need_right
 from pywikibot.site._extensions import (
     EchoMixin,
     FlowMixin,
@@ -1235,10 +1235,10 @@
             pywikibot.error(msg)
             raise

-        if MediaWikiVersion(version) < '1.27':
+        if MediaWikiVersion(version) < '1.31':
             raise RuntimeError(f'Pywikibot "{pywikibot.__version__}" does not '
-                               f'support MediaWiki "{version}".\n'
-                               f'Use Pywikibot prior to "8.0" branch instead.')
+                               f'support MediaWiki "{version}".\nUse '
+                               f'Pywikibot prior to "10.0" branch instead.')
         return version

     @property
@@ -2746,7 +2746,6 @@
         """
         return set(self.siteinfo.get('restrictions')['types'])

-    @need_version('1.27.3')
     def protection_levels(self) -> set[str]:
         """Return the protection levels available on this site.

diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index f1b2256..1c58945 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -26,7 +26,7 @@
 SERVER_DB_ERROR_MSG = \
     '<h1>Sorry! This site is experiencing technical difficulties.</h1>'

-MIN_VERSION = MediaWikiVersion('1.27')
+MIN_VERSION = MediaWikiVersion('1.31')


 class MWSite:
@@ -40,7 +40,7 @@
             occurred while loading the site
         :raises Timeout: a timeout occurred while loading the site
         :raises RuntimeError: Version not found or version less than
-            1.27
+            1.31
         """
         fromurl = removesuffix(fromurl, '$1')

diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index 79060f2..3a9ed6c 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -496,6 +496,14 @@
         """Return version number with optional suffix."""
         return '.'.join(str(v) for v in self.version) + self.suffix

+    def __repr__(self) -> str:
+        """Return version number representation, mainly used by tests.
+
+        .. versionadded:: 10.0
+
+        """
+        return f"'{self}'"
+
     def __eq__(self, other: Any) -> bool:
         if isinstance(other, str):
             other = MediaWikiVersion(other)
diff --git a/tests/logentries_tests.py b/tests/logentries_tests.py
index 2aa90ce..1d74f6f 100755
--- a/tests/logentries_tests.py
+++ b/tests/logentries_tests.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
-"""Test logentries module."""
+"""Test :mod:`logentries` module."""
 #
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2024
 #
 # Distributed under the terms of the MIT license.
 #
@@ -28,11 +28,10 @@

     """Base class for log entry tests.

-    It uses the German Wikipedia for a current representation of the
-    log entries and the test Wikipedia for the future representation.
-    It also tests on a wiki with MW <= 1.27 to check that the module
-    works with older wikis. It currently uses infogalacticwiki which as
-    of this commit uses 1.27.1.
+    It uses the German Wikipedia for a current representation of the log
+    entries and the test Wikipedia for the future representation. It
+    also tests on an older wiki to check that the module works with it.
+    It currently uses lobbypedia which as of this commit uses 1.31.6.
     """

     sites = {
@@ -52,9 +51,9 @@
             'target': None,
         },
         'old': {
-            'family': AutoFamily('infogalactic',
-                                 'https://infogalactic.com/info/Main_Page'),
-            'code': 'en',
+            'family': AutoFamily('lobbypedia',
+                                 'https://lobbypedia.de/wiki/Hauptseite'),
+            'code': 'de',
             'target': None,
         }
     }
@@ -65,7 +64,7 @@
             # This is an assertion as the tests don't make sense with newer
             # MW versions and otherwise it might not be visible that the test
             # isn't run on an older wiki.
-            self.assertEqual(self.site.mw_version, '1.27.1')
+            self.assertEqual(self.site.mw_version, '1.31.6')

         with skipping(StopIteration,
                       msg=f'No entry found for {logtype!r}'):
diff --git a/tests/site_detect_tests.py b/tests/site_detect_tests.py
index 3c18a1a..9fa4a5f 100755
--- a/tests/site_detect_tests.py
+++ b/tests/site_detect_tests.py
@@ -69,26 +69,21 @@

     non_standard_version_sites = (
         'https://wiki.gentoo.org/wiki/$1',
-        'https://www.arabeyes.org/$1',
     )

     old_version_sites = (
         'http://tfwiki.net/wiki/$1',  # 1.19.5-1+deb7u1
-        'http://www.hrwiki.org/index.php/$1',  # v 1.15.4
         'http://www.thelemapedia.org/index.php/$1',
         'http://www.werelate.org/wiki/$1',
-        'http://www.otterstedt.de/wiki/index.php/$1',
         'https://en.wikifur.com/wiki/$1',  # 1.23.16
+        'https://www.arabeyes.org/$1',  # non standard 1.28.0
     )

     no_sites = (
-        'http://www.imdb.com/name/nm$1/',
-        'http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=$1',
         'http://www.tvtropes.org/pmwiki/pmwiki.php/Main/$1',
         'http://c2.com/cgi/wiki?$1',
         'https://phabricator.wikimedia.org/$1',
         'http://www.merriam-webster.com/'
-        'cgi-bin/dictionary?book=Dictionary&va=$1',
         'http://arxiv.org/abs/$1',
         # looks like a MW site but isn't, api is redirected to
         # https://foundation.wikimedia.org

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

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I9f33aa6e2ca8ebcda77b8e05ad45e62c66e24bc7
Gerrit-Change-Number: 1101142
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <i...@gno.de>
Gerrit-Reviewer: Xqt <i...@gno.de>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- pywikibot-commits@lists.wikimedia.org
To unsubscribe send an email to pywikibot-commits-le...@lists.wikimedia.org

Reply via email to