jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[tests] Remove PYWIKIBOT_TEST_GUI variable

Remove PYWIKIBOT_TEST_GUI variable which isn't used by any test.
Skip tests if tkinter module is not installed.

Change-Id: I092214361bda86f5adb6fb425a6486f1c151b36e
---
M tests/tk_tests.py
1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/tests/tk_tests.py b/tests/tk_tests.py
index a746cee..58a283d 100755
--- a/tests/tk_tests.py
+++ b/tests/tk_tests.py
@@ -5,18 +5,11 @@
#
# Distributed under the terms of the MIT license.
#
-import os
import unittest
from contextlib import suppress

import pywikibot
-from tests.aspects import DefaultSiteTestCase, TestCase
-
-
-if os.environ.get('PYWIKIBOT_TEST_GUI', '0') == '1':
- import tkinter
-
- from pywikibot.userinterfaces.gui import EditBoxWindow, Tkdialog
+from tests.aspects import DefaultSiteTestCase, TestCase, require_modules


class TestTkdialog(TestCase):
@@ -53,10 +46,12 @@
self.assertIsNone(v)


+@require_modules('tkinter')
def setUpModule():
- """Skip Travis tests if PYWIKIBOT_TEST_GUI variable is not set."""
- if os.environ.get('PYWIKIBOT_TEST_GUI', '0') != '1':
- raise unittest.SkipTest('Tkinter tests are disabled on Travis-CI')
+ """Skip tests if tkinter is not installed. Otherwise import it."""
+ global EditBoxWindow, Tkdialog, tkinter
+ import tkinter
+ from pywikibot.userinterfaces.gui import EditBoxWindow, Tkdialog


if __name__ == '__main__': # pragma: no cover

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

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