1import sys 2import unittest 3from test import support 4from test.support import import_helper 5from test.support import check_sanitizer 6 7if check_sanitizer(address=True, memory=True): 8 raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds") 9 10 11# Skip this test if the _tkinter module wasn't built. 12_tkinter = import_helper.import_module('_tkinter') 13 14# Skip test if tk cannot be initialized. 15support.requires('gui') 16 17# Suppress the deprecation warning 18tix = import_helper.import_module('tkinter.tix', deprecated=True) 19from tkinter import TclError 20 21 22class TestTix(unittest.TestCase): 23 24 def setUp(self): 25 try: 26 self.root = tix.Tk() 27 except TclError: 28 if sys.platform.startswith('win'): 29 self.fail('Tix should always be available on Windows') 30 self.skipTest('Tix not available') 31 else: 32 self.addCleanup(self.root.destroy) 33 34 def test_tix_available(self): 35 # this test is just here to make setUp run 36 pass 37 38 39if __name__ == '__main__': 40 unittest.main() 41