jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[tests] import safe_repr in aspects.py only

- safe_repr is used in aspects.py only and should not be used
elswhere
- also import unittest directly

Change-Id: Ie94200847e5f935c6db8a25277ac60e1d18037a6
---
M tests/__init__.py
M tests/aspects.py
2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/tests/__init__.py b/tests/__init__.py
index 2c2a542..8475379 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,7 +1,6 @@
-# -*- coding: utf-8 -*-
"""Package tests."""
#
-# (C) Pywikibot team, 2007-2020
+# (C) Pywikibot team, 2007-2021
#
# Distributed under the terms of the MIT license.
#
@@ -18,7 +17,6 @@
from itertools import chain
from unittest import mock
from unittest.mock import MagicMock, Mock, patch
-from unittest.util import safe_repr

# Verify that the unit tests have a base working environment:
# - requests is mandatory
@@ -33,8 +31,6 @@
from pywikibot.data.api import Request as _original_Request
from pywikibot.tools import PYTHON_VERSION

-
-assert safe_repr # pyflakes workaround
_root_dir = os.path.split(os.path.split(__file__)[0])[0]


diff --git a/tests/aspects.py b/tests/aspects.py
index 323ac86..dc8f37e 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -16,10 +16,12 @@
import re
import sys
import time
+import unittest
import warnings

from contextlib import contextmanager, suppress
from collections.abc import Sized
+from unittest.util import safe_repr

import pywikibot

@@ -33,8 +35,7 @@
from pywikibot.family import WikimediaFamily
from pywikibot.site import BaseSite

-from tests import (
- safe_repr, unittest, patch_request, unpatch_request, unittest_print)
+from tests import patch_request, unpatch_request, unittest_print
from tests.utils import (
execute_pwb, DrySite, DryRequest,
WarningSourceSkipContextManager, AssertAPIErrorContextManager,

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

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie94200847e5f935c6db8a25277ac60e1d18037a6
Gerrit-Change-Number: 656600
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged