jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[IMPR] Rewrite pywikibot scripts to support Python 3.5+ only

Bug: T257399
Change-Id: I0c644a49a060925e058e6c9e4f9bcc2a97e0b5d9
---
M tests/flow_thanks_tests.py
M tests/imagecopy_tests.py
M tests/login_tests.py
M tests/noreferences_tests.py
M tests/pwb_tests.py
M tests/reflinks_tests.py
M tests/site_decorators_tests.py
7 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/tests/flow_thanks_tests.py b/tests/flow_thanks_tests.py
index 7730992..34f8ba2 100644
--- a/tests/flow_thanks_tests.py
+++ b/tests/flow_thanks_tests.py
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
"""Tests for thanks-related code."""
#
-# (C) Pywikibot team, 2016-2019
+# (C) Pywikibot team, 2016-2020
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
from pywikibot.flow import Topic

from tests.aspects import TestCase
@@ -28,7 +26,7 @@
@classmethod
def setUpClass(cls):
"""Set up class."""
- super(TestThankFlowPost, cls).setUpClass()
+ super().setUpClass()
cls._topic_title = 'Topic:Tvkityksg1ukyrrw'

def test_thank_post(self):
diff --git a/tests/imagecopy_tests.py b/tests/imagecopy_tests.py
index 09a2def..7dedfa0 100644
--- a/tests/imagecopy_tests.py
+++ b/tests/imagecopy_tests.py
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
"""Tests for imagecopy script."""
#
-# (C) Pywikibot team, 2018
+# (C) Pywikibot team, 2018-2020
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import re

from scripts.imagecopy import pageTextPost
diff --git a/tests/login_tests.py b/tests/login_tests.py
index 888747c..a8f3cb3 100644
--- a/tests/login_tests.py
+++ b/tests/login_tests.py
@@ -5,12 +5,10 @@
e.g. used to test password-file based login.
"""
#
-# (C) Pywikibot team, 2012-2018
+# (C) Pywikibot team, 2012-2020
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
from collections import defaultdict
from io import StringIO

@@ -94,7 +92,7 @@

def setUp(self):
"""Patch a variety of dependencies."""
- super(TestPasswordFile, self).setUp()
+ super().setUp()
self.config = self.patch('pywikibot.login.config')
self.config.usernames = FakeConfig.usernames
self.config.password_file = '~FakeFile'
diff --git a/tests/noreferences_tests.py b/tests/noreferences_tests.py
index e3c9f5b..02f190d 100644
--- a/tests/noreferences_tests.py
+++ b/tests/noreferences_tests.py
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
"""Test noreferences bot module."""
#
-# (C) Pywikibot team, 2018
+# (C) Pywikibot team, 2018-2020
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import pywikibot

from scripts.noreferences import NoReferencesBot
diff --git a/tests/pwb_tests.py b/tests/pwb_tests.py
index ab653d3..0ed6ecc 100644
--- a/tests/pwb_tests.py
+++ b/tests/pwb_tests.py
@@ -11,8 +11,6 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
import io
import sys

diff --git a/tests/reflinks_tests.py b/tests/reflinks_tests.py
index 11d54d7..7a0d260 100644
--- a/tests/reflinks_tests.py
+++ b/tests/reflinks_tests.py
@@ -5,8 +5,6 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
from scripts.reflinks import XmlDumpPageGenerator, ReferencesRobot, main

from tests import join_xml_data_path
@@ -137,7 +135,7 @@

def setUp(self):
"""Set up the script by patching the bot class."""
- super(TestReferencesBotConstructor, self).setUp()
+ super().setUp()
self._original_constructor = ReferencesRobot.__init__
self._original_run = ReferencesRobot.run
ReferencesRobot.__init__ = dummy_constructor
@@ -148,7 +146,7 @@
ReferencesRobot.__init__ = self._original_constructor
ReferencesRobot.run = self._original_run
with empty_sites():
- super(TestReferencesBotConstructor, self).tearDown()
+ super().tearDown()

def test_xml_simple(self):
"""Test the generator without any narrowing."""
diff --git a/tests/site_decorators_tests.py b/tests/site_decorators_tests.py
index f2d30c0..5962145 100644
--- a/tests/site_decorators_tests.py
+++ b/tests/site_decorators_tests.py
@@ -5,8 +5,6 @@
#
# Distributed under the terms of the MIT license.
#
-from __future__ import absolute_import, division, unicode_literals
-
from pywikibot.tools import deprecated
from pywikibot.site._decorators import must_be, need_right, need_version
from pywikibot.exceptions import UserRightsError
@@ -31,7 +29,7 @@
self._logged_in_as = None
self._userinfo = []
self.obsolete = False
- super(TestMustBe, self).setUp()
+ super().setUp()
self.version = lambda: '1.19' # lowest supported release

def login(self, group):
@@ -143,7 +141,7 @@
self._logged_in_as = None
self._userinfo = []
self.obsolete = False
- super(TestNeedRight, self).setUp()
+ super().setUp()
self.version = lambda: '1.14' # lowest supported release

def login(self, group, right):
@@ -200,7 +198,7 @@
# were not completely disposed and recreated but retained 'memory'
def setUp(self):
"""Set up test method."""
- super(TestNeedVersion, self).setUp()
+ super().setUp()
self.version = lambda: '1.23'

@need_version('1.24')

To view, visit change 640361. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I0c644a49a060925e058e6c9e4f9bcc2a97e0b5d9
Gerrit-Change-Number: 640361
Gerrit-PatchSet: 2
Gerrit-Owner: Udoka <UdokakuUgochukwu@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged