jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831065 )

Change subject: [tests] Remove PYWIKIBOT_TEST_GUI variable
......................................................................

[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(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



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 https://gerrit.wikimedia.org/r/c/pywikibot/core/+/831065
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I092214361bda86f5adb6fb425a6486f1c151b36e
Gerrit-Change-Number: 831065
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to