Zachary Ware | 4baebfe | 2015-05-17 20:55:42 -0500 | [diff] [blame] | 1 | import unittest |
| 2 | from test import support |
Hai Shi | f7ba40b | 2020-06-25 18:38:51 +0800 | [diff] [blame] | 3 | from test.support import import_helper |
Zachary Ware | 4baebfe | 2015-05-17 20:55:42 -0500 | [diff] [blame] | 4 | import sys |
| 5 | |
| 6 | # Skip this test if the _tkinter module wasn't built. |
Hai Shi | f7ba40b | 2020-06-25 18:38:51 +0800 | [diff] [blame] | 7 | _tkinter = import_helper.import_module('_tkinter') |
Zachary Ware | 4baebfe | 2015-05-17 20:55:42 -0500 | [diff] [blame] | 8 | |
| 9 | # Skip test if tk cannot be initialized. |
| 10 | support.requires('gui') |
| 11 | |
| 12 | from tkinter import tix, TclError |
| 13 | |
| 14 | |
| 15 | class TestTix(unittest.TestCase): |
| 16 | |
| 17 | def setUp(self): |
| 18 | try: |
| 19 | self.root = tix.Tk() |
| 20 | except TclError: |
| 21 | if sys.platform.startswith('win'): |
| 22 | self.fail('Tix should always be available on Windows') |
| 23 | self.skipTest('Tix not available') |
| 24 | else: |
| 25 | self.addCleanup(self.root.destroy) |
| 26 | |
| 27 | def test_tix_available(self): |
| 28 | # this test is just here to make setUp run |
| 29 | pass |
| 30 | |
| 31 | |
| 32 | if __name__ == '__main__': |
| 33 | unittest.main() |