jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/553861 )
Change subject: [Python] Deprecation warning for Python 3.4 ......................................................................
[Python] Deprecation warning for Python 3.4
Bug: T239542 Change-Id: Ie656f71cb109ec1db951562ebc2a13e3c37281da --- M pywikibot/__init__.py M tests/utils.py 2 files changed, 9 insertions(+), 6 deletions(-)
Approvals: Zhuyifei1999: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/__init__.py b/pywikibot/__init__.py index 903d147..7214aa2 100644 --- a/pywikibot/__init__.py +++ b/pywikibot/__init__.py @@ -15,6 +15,7 @@ from decimal import Decimal import math import re +import sys import threading import time
@@ -65,7 +66,7 @@ MediaWikiVersion as _MediaWikiVersion, redirect_func, ModuleDeprecationWrapper as _ModuleDeprecationWrapper, - PY2, + PY2, PYTHON_VERSION, UnicodeMixin, UnicodeType ) @@ -115,12 +116,14 @@ # T111615: Python 2 requires __all__ is bytes globals()['__all__'] = tuple(bytes(item) for item in __all__)
- import sys +if PY2 or PYTHON_VERSION < (3, 5, 0): warn(""" + Python {version} will be dropped soon. It is recommended to use Python 3.5 or above. -See T213287 for further information. -""".format(version=sys.version.split(None, 1)[0]), +See {what} for further information. +""".format(version=sys.version.split(None, 1)[0], + what='T213287' if PY2 else 'T239542'), FutureWarning) # probably adjust the line no in utils.execute()
for _name in textlib_methods: diff --git a/tests/utils.py b/tests/utils.py index 3f73c08..1d917cb 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -654,8 +654,8 @@ @param command: executable to run and arguments to use @type command: list of unicode """ - if PY2: - command.insert(1, '-W ignore::FutureWarning:pywikibot:124') + if PY2 or PYTHON_VERSION < (3, 5, 0): + command.insert(1, '-W ignore::FutureWarning:pywikibot:127') if cryptography_version and cryptography_version < [1, 3, 4]: command.insert(1, '-W ignore:Old version of cryptography:Warning') # Any environment variables added on Windows must be of type
pywikibot-commits@lists.wikimedia.org