Zachary Ware | 4baebfe | 2015-05-17 20:55:42 -0500 | [diff] [blame] | 1 | import unittest |
| 2 | from test import support |
| 3 | import sys |
| 4 | |
| 5 | # Skip this test if the _tkinter module wasn't built. |
| 6 | _tkinter = support.import_module('_tkinter') |
| 7 | |
| 8 | # Skip test if tk cannot be initialized. |
| 9 | support.requires('gui') |
| 10 | |
| 11 | from tkinter import tix, TclError |
| 12 | |
| 13 | |
| 14 | class TestTix(unittest.TestCase): |
| 15 | |
| 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 | |
| 26 | def test_tix_available(self): |
| 27 | # this test is just here to make setUp run |
| 28 | pass |
| 29 | |
| 30 | |
| 31 | if __name__ == '__main__': |
| 32 | unittest.main() |