jenkins-bot merged this change.
[bugfix] enable various test files
Bug: T203877
Change-Id: I57d3c2a5d4b32ea887dda7f5faa4bb03c0a23f99
---
M tests/__init__.py
M tests/flow_edit_tests.py
M tests/flow_tests.py
M tests/flow_thanks_tests.py
M tests/imagecopy_tests.py
M tests/thanks_tests.py
M tests/utils.py
7 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/tests/__init__.py b/tests/__init__.py
index 39a1651..16af996 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -342,3 +342,10 @@
"""Un-patch Request classes with TestRequest."""
pywikibot.data.api.Request = _original_Request
pywikibot.data.api.CachedRequest._expired = original_expired
+
+
+if __name__ == '__main__': # pragma: no cover
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
diff --git a/tests/flow_edit_tests.py b/tests/flow_edit_tests.py
index 4acc7f3..c8d346c 100644
--- a/tests/flow_edit_tests.py
+++ b/tests/flow_edit_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Edit tests for the flow module."""
#
-# (C) Pywikibot team, 2015-2016
+# (C) Pywikibot team, 2015-2018
#
# Distributed under the terms of the MIT license.
#
@@ -12,6 +12,7 @@
from pywikibot.tools import UnicodeType as unicode
from tests.aspects import TestCase
+from tests import unittest
class TestFlowCreateTopic(TestCase):
@@ -320,3 +321,10 @@
self.assertRaises(LockedPage, topic_root.reply, content, 'wikitext')
topic_reply = topic.root.replies(force=True)[0]
self.assertRaises(LockedPage, topic_reply.reply, content, 'wikitext')
+
+
+if __name__ == '__main__': # pragma: no cover
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
diff --git a/tests/flow_tests.py b/tests/flow_tests.py
index 36c1149..f5dd438 100644
--- a/tests/flow_tests.py
+++ b/tests/flow_tests.py
@@ -11,6 +11,7 @@
from pywikibot.flow import Board, Topic, Post
from pywikibot.tools import UnicodeType as unicode
+from tests import unittest
from tests.aspects import (
TestCase,
)
@@ -242,3 +243,10 @@
topic_hidden = Topic(self.site, 'Topic:U5y53rn0dp6h70nw')
self.assertFalse(topic_hidden.is_locked)
self.assertTrue(topic_hidden.is_moderated)
+
+
+if __name__ == '__main__': # pragma: no cover
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
diff --git a/tests/flow_thanks_tests.py b/tests/flow_thanks_tests.py
index 38c423e..8fadb67 100644
--- a/tests/flow_thanks_tests.py
+++ b/tests/flow_thanks_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Tests for thanks-related code."""
#
-# (C) Pywikibot team, 2016-2017
+# (C) Pywikibot team, 2016-2018
#
# Distributed under the terms of the MIT license.
#
@@ -10,6 +10,7 @@
from pywikibot.flow import Topic
from tests.aspects import TestCase
+from tests import unittest
NO_THANKABLE_POSTS = 'There is no recent post which can be test thanked.'
@@ -58,3 +59,10 @@
topic = Topic(site, self._topic_title)
my_reply = topic.reply('My attempt to thank myself.')
self.assertAPIError('invalidrecipient', None, my_reply.thank)
+
+
+if __name__ == '__main__': # pragma: no cover
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
diff --git a/tests/imagecopy_tests.py b/tests/imagecopy_tests.py
index a5502f6..d6c38ce 100644
--- a/tests/imagecopy_tests.py
+++ b/tests/imagecopy_tests.py
@@ -11,8 +11,8 @@
from scripts.imagecopy import pageTextPost
+from tests import join_data_path, unittest
from tests.aspects import TestCase
-from tests import join_data_path
class CommonsHelperMethodTest(TestCase):
@@ -41,3 +41,10 @@
re.DOTALL | re.M).findall(commons_helper)[0])
with open(join_data_path('commonsHelper_description.txt')) as f:
self.assertEqual(f.read(), commons_helper)
+
+
+if __name__ == '__main__': # pragma: no cover
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
diff --git a/tests/thanks_tests.py b/tests/thanks_tests.py
index 91d0405..9e5decc 100644
--- a/tests/thanks_tests.py
+++ b/tests/thanks_tests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Tests for thanks-related code."""
#
-# (C) Pywikibot team, 2016-2017
+# (C) Pywikibot team, 2016-2018
#
# Distributed under the terms of the MIT license.
#
@@ -10,6 +10,7 @@
from pywikibot.page import Page, Revision, User
from tests.aspects import TestCase
+from tests import unittest
NO_THANKABLE_REVS = 'There is no recent change which can be test thanked.'
@@ -105,3 +106,10 @@
for invalid_revid in invalid_revids:
self.assertAPIError('invalidrevision', None, Revision._thank,
invalid_revid, site, source='pywikibot test')
+
+
+if __name__ == '__main__': # pragma: no cover
+ try:
+ unittest.main()
+ except SystemExit:
+ pass
diff --git a/tests/utils.py b/tests/utils.py
index fe8a9ed..12841b1 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -33,8 +33,7 @@
PY2, PYTHON_VERSION,
UnicodeType as unicode,
)
-from tests import _pwb_py
-from tests import unittest
+from tests import _pwb_py, unittest
if not PY2:
import six
To view, visit change 459250. To unsubscribe, or for help writing mail filters, visit settings.