test_tix.py 1.0 KB

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