jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/675169 )
Change subject: [tests] Don't import standard library parts from tests ......................................................................
[tests] Don't import standard library parts from tests
add funktions to __all__ which are and should only be imported; requests, unittest, mock, patch should imported directly instead
Change-Id: I030a2c97ba1ba0c28c2dbfc4166af76b16e89a9c --- M tests/__init__.py 1 file changed, 8 insertions(+), 5 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/__init__.py b/tests/__init__.py index cb700bb..db64b70 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -5,8 +5,11 @@ # Distributed under the terms of the MIT license. # __all__ = ( - 'requests', 'unittest', 'TestRequest', 'patch_request', 'unpatch_request', - 'mock', 'Mock', 'MagicMock', 'patch') + 'create_path_func', 'join_cache_path', 'join_data_path', + 'join_html_data_path', 'join_images_path', 'join_pages_path', + 'join_root_path', 'join_xml_data_path', 'patch_request', 'unittest_print', + 'unpatch_request', +)
import functools import os @@ -15,14 +18,14 @@
from contextlib import suppress from itertools import chain -from unittest import mock -from unittest.mock import MagicMock, Mock, patch +from unittest import mock # noqa: F401 +from unittest.mock import MagicMock, Mock, patch # noqa: F401
# Verify that the unit tests have a base working environment: # - requests is mandatory # however if unavailable this will fail on use; see pywikibot/tools.py # - mwparserfromhell is optional, so is only imported in textlib_tests -import requests +import requests # noqa: F401
import pywikibot.data.api
pywikibot-commits@lists.wikimedia.org