blob: a2fb357fd0c500be7317c9c26c29ae65cc4713e6 [file] [log] [blame]
Miss Islington (bot)ec6a1ea2021-05-07 09:14:48 -07001import sys
Zachary Ware4baebfe2015-05-17 20:55:42 -05002import unittest
3from test import support
Hai Shif7ba40b2020-06-25 18:38:51 +08004from test.support import import_helper
Zachary Ware4baebfe2015-05-17 20:55:42 -05005
6# Skip this test if the _tkinter module wasn't built.
Hai Shif7ba40b2020-06-25 18:38:51 +08007_tkinter = import_helper.import_module('_tkinter')
Zachary Ware4baebfe2015-05-17 20:55:42 -05008
9# Skip test if tk cannot be initialized.
10support.requires('gui')
11
Miss Islington (bot)ec6a1ea2021-05-07 09:14:48 -070012# Suppress the deprecation warning
13tix = import_helper.import_module('tkinter.tix', deprecated=True)
14from tkinter import TclError
Zachary Ware4baebfe2015-05-17 20:55:42 -050015
16
17class TestTix(unittest.TestCase):
18
19 def setUp(self):
20 try:
21 self.root = tix.Tk()
22 except TclError:
23 if sys.platform.startswith('win'):
24 self.fail('Tix should always be available on Windows')
25 self.skipTest('Tix not available')
26 else:
27 self.addCleanup(self.root.destroy)
28
Miss Islington (bot)ec6a1ea2021-05-07 09:14:48 -070029 def test_tix_deprecation(self):
30 with self.assertWarns(DeprecationWarning):
31 import_helper.import_fresh_module(
32 'tkinter.tix',
33 fresh=('tkinter.tix',),
34 )
Zachary Ware4baebfe2015-05-17 20:55:42 -050035
36
37if __name__ == '__main__':
38 unittest.main()