Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/291524
Change subject: [impr] path support for tests ...................................................................... [impr] path support for tests Change-Id: I4d8c51ba540134193456af22fd8e58c4d93637a4 --- M tests/afd_notice_tests.py M tests/checkvotes_tests.py M tests/imagereview_tests.py A tests/utils.py M tests/vandalism_tests.py 5 files changed, 23 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot refs/changes/24/291524/1 diff --git a/tests/afd_notice_tests.py b/tests/afd_notice_tests.py index 1fe53eb..a9301a6 100644 --- a/tests/afd_notice_tests.py +++ b/tests/afd_notice_tests.py @@ -14,11 +14,7 @@ import sys import unittest -currentdir = os.path.dirname( - os.path.abspath(inspect.getfile(inspect.currentframe()))) -parentdir = os.path.dirname(currentdir) -sys.path.insert(0, parentdir) - +import utils import afd_notice import pywikibot diff --git a/tests/checkvotes_tests.py b/tests/checkvotes_tests.py index 17593de..684c677 100644 --- a/tests/checkvotes_tests.py +++ b/tests/checkvotes_tests.py @@ -14,11 +14,7 @@ import sys import unittest -currentdir = os.path.dirname( - os.path.abspath(inspect.getfile(inspect.currentframe()))) -parentdir = os.path.dirname(currentdir) -sys.path.insert(0, parentdir) - +import utils from pywikibot.comms.http import fetch from checkvotes import SB_TOOL, SB_TOOL2, SB_TOOL3, SB_TOOL_NEW diff --git a/tests/imagereview_tests.py b/tests/imagereview_tests.py index baa9de8..f7405d1 100644 --- a/tests/imagereview_tests.py +++ b/tests/imagereview_tests.py @@ -14,11 +14,7 @@ import sys import unittest -currentdir = os.path.dirname( - os.path.abspath(inspect.getfile(inspect.currentframe()))) -parentdir = os.path.dirname(currentdir) -sys.path.insert(0, parentdir) - +import utils import imagereview # noqa import pywikibot diff --git a/tests/utils.py b/tests/utils.py new file mode 100644 index 0000000..568a040 --- /dev/null +++ b/tests/utils.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +"""Support module for test suite.""" +# +# (C) xqt, 2016 +# +# Distributed under the terms of the MIT license. +# +from __future__ import absolute_import, print_function, unicode_literals + +__version__ = '$Id: $' + +import sys + +# Add current directory and parent directory to module search path. +sys.path.insert(0, '..') +sys.path.insert(0, '.') + +del sys diff --git a/tests/vandalism_tests.py b/tests/vandalism_tests.py index fc49eeb..37a7f56 100644 --- a/tests/vandalism_tests.py +++ b/tests/vandalism_tests.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Test vandalism modules.""" # -# (C) xqt, 2015 +# (C) xqt, 2015-2016 # # Distributed under the terms of the MIT license. # @@ -14,11 +14,7 @@ import sys import unittest -currentdir = os.path.dirname( - os.path.abspath(inspect.getfile(inspect.currentframe()))) -parentdir = os.path.dirname(currentdir) -sys.path.insert(0, parentdir) - +import utils from vandalism import getAccuser -- To view, visit https://gerrit.wikimedia.org/r/291524 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4d8c51ba540134193456af22fd8e58c4d93637a4 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/bots/xqbot Gerrit-Branch: master Gerrit-Owner: Xqt <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
