jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/792930 )
Change subject: [py35] Show a warning if Pywikibot is running with Python 3.5 and below ......................................................................
[py35] Show a warning if Pywikibot is running with Python 3.5 and below
After toolforge was migrated from Debian Stretch to Debian Buster Python 3.7.3 is available and Python 3.5 can be dropped. Show a FutureWarning for the deprecation time.
Bug: T301908 Change-Id: I27700d47f6c0577a054f8bd7cea252cd31abd5d8 --- M pywikibot/__init__.py M tests/utils.py 2 files changed, 14 insertions(+), 1 deletion(-)
Approvals: Matěj Suchánek: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index aead197..1df2fb1 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -67,7 +67,7 @@ warning, ) from pywikibot.site import APISite, BaseSite, DataSite -from pywikibot.tools import classproperty, normalize_username +from pywikibot.tools import classproperty, normalize_username, PYTHON_VERSION
ItemPageStrNoneType = Union[str, 'ItemPage', None] @@ -93,6 +93,15 @@ argvu = [] # type: List[str]
+if PYTHON_VERSION < (3, 6): + warn(""" +Python {version} will be dropped with release 8.0 soon. +It is recommended to use Python 3.6 or above. +See T301908 for further information. +""".format(version=sys.version.split(maxsplit=1)[0]), + FutureWarning) # adjust this line no in utils.execute() + + class Timestamp(datetime.datetime):
"""Class for handling MediaWiki timestamps. diff --git a/tests/utils.py b/tests/utils.py index 160d703..171e165 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -19,6 +19,8 @@ from pywikibot.exceptions import APIError from pywikibot.login import LoginStatus from pywikibot.site import Namespace +from pywikibot.tools import PYTHON_VERSION + from tests import _pwb_py
@@ -433,6 +435,8 @@ :param command: executable to run and arguments to use :type command: list of str """ + if PYTHON_VERSION < (3, 6): + command.insert(1, '-W ignore::FutureWarning:pywikibot:102') if cryptography_version and cryptography_version < [1, 3, 4]: command.insert(1, '-W ignore:Old version of cryptography:Warning')
pywikibot-commits@lists.wikimedia.org