]> granicus.if.org Git - python/commitdiff
Checking for tk availability before continuing (basically the same that is done in...
authorGuilherme Polo <ggpolo@gmail.com>
Mon, 9 Feb 2009 19:57:04 +0000 (19:57 +0000)
committerGuilherme Polo <ggpolo@gmail.com>
Mon, 9 Feb 2009 19:57:04 +0000 (19:57 +0000)
Lib/test/test_tk.py

index 5d79a3c2202af86c3d728484f05b21f86185a01f..e1f9c5bfe216305047d08f7287fb25d529569c77 100644 (file)
@@ -1,8 +1,14 @@
 import os
 import sys
-from _tkinter import TclError
+import Tkinter
 from test import test_support
 
+try:
+    Tkinter.Button()
+except Tkinter.TclError, msg:
+    # assuming tk is not available
+    raise test_support.TestSkipped("tk not available: %s" % msg)
+
 this_dir = os.path.dirname(os.path.abspath(__file__))
 lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
     'lib-tk', 'test'))