jenkins-bot has submitted this change and it was merged.
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, 24 insertions(+), 33 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/afd_notice_tests.py b/tests/afd_notice_tests.py
index 1fe53eb..d3cbea5 100644
--- a/tests/afd_notice_tests.py
+++ b/tests/afd_notice_tests.py
@@ -9,16 +9,9 @@
__version__ = '$Id $'
-import inspect
-import os
-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)
-
+from tests import utils # noqa
import afd_notice
import pywikibot
diff --git a/tests/checkvotes_tests.py b/tests/checkvotes_tests.py
index 17593de..2ae9adc 100644
--- a/tests/checkvotes_tests.py
+++ b/tests/checkvotes_tests.py
@@ -9,16 +9,9 @@
__version__ = '$Id$'
-import inspect
-import os
-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)
-
+from tests import utils # noqa
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..dcf4a27 100644
--- a/tests/imagereview_tests.py
+++ b/tests/imagereview_tests.py
@@ -9,17 +9,11 @@
__version__ = '$Id $'
-import inspect
-import os
-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)
+from tests import utils # noqa
+import imagereview
-import imagereview # noqa
import pywikibot
from pywikibot import Timestamp, config
diff --git a/tests/utils.py b/tests/utils.py
new file mode 100644
index 000..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..0b9d1ef 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.
#
@@ -9,16 +9,9 @@
__version__ = '$Id$'
-import inspect
-import os
-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)
-
+from tests import utils # noqa
from vandalism import getAccuser
--
To view, visit https://gerrit.wikimedia.org/r/291524
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4d8c51ba540134193456af22fd8e58c4d93637a4
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt
Gerrit-Reviewer: Xqt
Gerrit-Reviewer: jenkins-bot <>
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits