jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1217836?usp=email )
Change subject: tests: Import unittest directly from standard library
......................................................................
tests: Import unittest directly from standard library
Import unittest directly from standard library
and remove unittest imports from tests.aspects
Change-Id: I30cdf97b4d7cd31a731e1cab037be748d02886b7
---
M tests/basesite_tests.py
M tests/diff_tests.py
M tests/family_tests.py
M tests/fixing_redirects_tests.py
M tests/i18n_tests.py
M tests/interwiki_link_tests.py
M tests/login_tests.py
M tests/namespace_tests.py
M tests/noreferences_tests.py
M tests/patrolbot_tests.py
M tests/timestripper_tests.py
M tests/user_tests.py
M tests/weblinkchecker_tests.py
13 files changed, 36 insertions(+), 21 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/basesite_tests.py b/tests/basesite_tests.py
index 0bc7471..40e455e 100755
--- a/tests/basesite_tests.py
+++ b/tests/basesite_tests.py
@@ -7,12 +7,13 @@
#
from __future__ import annotations
+import unittest
from contextlib import suppress
import pywikibot
from pywikibot.backports import NoneType
from pywikibot.exceptions import Error
-from tests.aspects import DefaultSiteTestCase, TestCase, unittest
+from tests.aspects import DefaultSiteTestCase, TestCase
WARN_SELF_CALL = (r'Referencing this attribute like a function '
diff --git a/tests/diff_tests.py b/tests/diff_tests.py
index 3a96629..5306440 100755
--- a/tests/diff_tests.py
+++ b/tests/diff_tests.py
@@ -1,17 +1,18 @@
#!/usr/bin/env python3
"""Test diff module."""
#
-# (C) Pywikibot team, 2016-2022
+# (C) Pywikibot team, 2016-2025
#
# Distributed under the terms of the MIT license.
from __future__ import annotations
+import unittest
from contextlib import suppress
from unittest.mock import patch
from pywikibot.diff import PatchManager, cherry_pick, html_comparator
from tests import join_html_data_path
-from tests.aspects import TestCase, require_modules, unittest
+from tests.aspects import TestCase, require_modules
@require_modules('bs4')
diff --git a/tests/family_tests.py b/tests/family_tests.py
index b232698..69b3171 100755
--- a/tests/family_tests.py
+++ b/tests/family_tests.py
@@ -7,6 +7,7 @@
#
from __future__ import annotations
+import unittest
from collections.abc import Mapping
from contextlib import suppress
@@ -14,7 +15,7 @@
from pywikibot.exceptions import UnknownFamilyError
from pywikibot.family import Family, SingleSiteFamily
from pywikibot.tools import suppress_warnings
-from tests.aspects import PatchingTestCase, TestCase, unittest
+from tests.aspects import PatchingTestCase, TestCase
from tests.utils import DrySite
diff --git a/tests/fixing_redirects_tests.py b/tests/fixing_redirects_tests.py
index 79e99b6..ec3de6f 100755
--- a/tests/fixing_redirects_tests.py
+++ b/tests/fixing_redirects_tests.py
@@ -1,15 +1,17 @@
#!/usr/bin/env python3
"""Test fixing redirects bot module."""
#
-# (C) Pywikibot team, 2018-2022
+# (C) Pywikibot team, 2018-2025
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
+import unittest
+
import pywikibot
from scripts.fixing_redirects import FixingRedirectBot
-from tests.aspects import TestCase, unittest
+from tests.aspects import TestCase
class TestFixingRedirects(TestCase):
diff --git a/tests/i18n_tests.py b/tests/i18n_tests.py
index 65cad18..24533be 100755
--- a/tests/i18n_tests.py
+++ b/tests/i18n_tests.py
@@ -1,18 +1,19 @@
#!/usr/bin/env python3
"""Test i18n module."""
#
-# (C) Pywikibot team, 2007-2024
+# (C) Pywikibot team, 2007-2025
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
+import unittest
from contextlib import suppress
import pywikibot
from pywikibot import bot, config, i18n
from pywikibot.exceptions import TranslationError
-from tests.aspects import DefaultSiteTestCase, PwbTestCase, TestCase, unittest
+from tests.aspects import DefaultSiteTestCase, PwbTestCase, TestCase
class Site:
diff --git a/tests/interwiki_link_tests.py b/tests/interwiki_link_tests.py
index 6d805f7..92c09dc 100755
--- a/tests/interwiki_link_tests.py
+++ b/tests/interwiki_link_tests.py
@@ -7,13 +7,14 @@
#
from __future__ import annotations
+import unittest
from contextlib import suppress
from pywikibot import config
from pywikibot.exceptions import InvalidTitleError
from pywikibot.page import Link
from tests.aspects import AlteredDefaultSiteTestCase as LinkTestCase
-from tests.aspects import TestCase, unittest
+from tests.aspects import TestCase
class TestPartiallyQualifiedLinkDifferentCodeParser(LinkTestCase):
diff --git a/tests/login_tests.py b/tests/login_tests.py
index 963bff4..d2cdc29 100755
--- a/tests/login_tests.py
+++ b/tests/login_tests.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import builtins
+import unittest
import uuid
from collections import defaultdict
from io import StringIO
@@ -20,7 +21,7 @@
from pywikibot.exceptions import NoUsernameError
from pywikibot.login import LoginManager
from pywikibot.tools import PYTHON_VERSION
-from tests.aspects import DefaultDrySiteTestCase, unittest
+from tests.aspects import DefaultDrySiteTestCase
class FakeFamily:
diff --git a/tests/namespace_tests.py b/tests/namespace_tests.py
index 34fd6ad..9063fc9 100755
--- a/tests/namespace_tests.py
+++ b/tests/namespace_tests.py
@@ -1,18 +1,19 @@
#!/usr/bin/env python3
"""Tests for the Namespace class."""
#
-# (C) Pywikibot team, 2014-2022
+# (C) Pywikibot team, 2014-2025
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
+import unittest
from collections.abc import Iterable
from contextlib import suppress
from pywikibot.site import Namespace, NamespacesDict
from pywikibot.site._namespace import BuiltinNamespace
-from tests.aspects import TestCase, unittest
+from tests.aspects import TestCase
# Default namespaces which should work in any MW wiki
diff --git a/tests/noreferences_tests.py b/tests/noreferences_tests.py
index dae01e0..93b0521 100755
--- a/tests/noreferences_tests.py
+++ b/tests/noreferences_tests.py
@@ -1,15 +1,17 @@
#!/usr/bin/env python3
"""Test noreferences bot module."""
#
-# (C) Pywikibot team, 2018-2022
+# (C) Pywikibot team, 2018-2025
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
+import unittest
+
import pywikibot
from scripts.noreferences import NoReferencesBot
-from tests.aspects import TestCase, unittest
+from tests.aspects import TestCase
class TestAddingReferences(TestCase):
diff --git a/tests/patrolbot_tests.py b/tests/patrolbot_tests.py
index 236f50d..12bfa03 100755
--- a/tests/patrolbot_tests.py
+++ b/tests/patrolbot_tests.py
@@ -1,16 +1,17 @@
#!/usr/bin/env python3
"""Tests for the patrol script."""
#
-# (C) Pywikibot team, 2015-2023
+# (C) Pywikibot team, 2015-2025
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
+import unittest
from contextlib import suppress
from scripts.patrol import PatrolBot
-from tests.aspects import DefaultDrySiteTestCase, unittest
+from tests.aspects import DefaultDrySiteTestCase
DUMMY_PAGE_TUPLES = """
diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py
index fd49676..157b78b 100755
--- a/tests/timestripper_tests.py
+++ b/tests/timestripper_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Tests for archivebot.py/Timestripper."""
#
-# (C) Pywikibot team, 2014-2024
+# (C) Pywikibot team, 2014-2025
#
# Distributed under the terms of the MIT license.
#
@@ -9,11 +9,12 @@
import datetime
import re
+import unittest
from contextlib import suppress
from pywikibot.textlib import TimeStripper
from pywikibot.time import TZoneFixedOffset
-from tests.aspects import TestCase, unittest
+from tests.aspects import TestCase
MatchObject = type(re.search('', ''))
diff --git a/tests/user_tests.py b/tests/user_tests.py
index be5dbeb..651734a 100755
--- a/tests/user_tests.py
+++ b/tests/user_tests.py
@@ -1,19 +1,20 @@
#!/usr/bin/env python3
"""Tests for the User page."""
#
-# (C) Pywikibot team, 2016-2024
+# (C) Pywikibot team, 2016-2025
#
# Distributed under the terms of the MIT license.
#
from __future__ import annotations
+import unittest
from contextlib import suppress
from unittest.mock import patch
import pywikibot
from pywikibot import Page, Timestamp, User
from pywikibot.exceptions import AutoblockUserError
-from tests.aspects import DefaultSiteTestCase, TestCase, unittest
+from tests.aspects import DefaultSiteTestCase, TestCase
class TestUserClass(TestCase):
diff --git a/tests/weblinkchecker_tests.py b/tests/weblinkchecker_tests.py
index 5a1b9a5..db854a0 100755
--- a/tests/weblinkchecker_tests.py
+++ b/tests/weblinkchecker_tests.py
@@ -7,11 +7,12 @@
#
from __future__ import annotations
+import unittest
from contextlib import suppress
import pywikibot
from scripts.weblinkchecker import WeblinkCheckerRobot
-from tests.aspects import TestCase, unittest
+from tests.aspects import TestCase
class TestWeblinkchecker(TestCase):
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1217836?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: I30cdf97b4d7cd31a731e1cab037be748d02886b7
Gerrit-Change-Number: 1217836
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]