summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tix.py
diff options
context:
space:
mode:
authorwyz23x2 <52805709+wyz23x2@users.noreply.github.com>2021-05-07 15:53:23 (GMT)
committerGitHub <noreply@github.com>2021-05-07 15:53:23 (GMT)
commit4a2d98a1e98de25c5114d11fcb0f9fedbb057e51 (patch)
treec9302fd32b39bf5f89b8f59de469c394a5eeb1bd /Lib/test/test_tix.py
parentadcd2205565f91c6719f4141ab4e1da6d7086126 (diff)
downloadcpython-4a2d98a1e98de25c5114d11fcb0f9fedbb057e51.zip
cpython-4a2d98a1e98de25c5114d11fcb0f9fedbb057e51.tar.gz
cpython-4a2d98a1e98de25c5114d11fcb0f9fedbb057e51.tar.bz2
bpo-41730: Show deprecation warnings for tkinter.tix (GH-22186)
Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com> Co-authored-by: Zachary Ware <zach@python.org>
Diffstat (limited to 'Lib/test/test_tix.py')
-rw-r--r--Lib/test/test_tix.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/test/test_tix.py b/Lib/test/test_tix.py
index e6d759e..a2fb357 100644
--- a/Lib/test/test_tix.py
+++ b/Lib/test/test_tix.py
@@ -1,7 +1,7 @@
+import sys
import unittest
from test import support
from test.support import import_helper
-import sys
# Skip this test if the _tkinter module wasn't built.
_tkinter = import_helper.import_module('_tkinter')
@@ -9,7 +9,9 @@ _tkinter = import_helper.import_module('_tkinter')
# Skip test if tk cannot be initialized.
support.requires('gui')
-from tkinter import tix, TclError
+# Suppress the deprecation warning
+tix = import_helper.import_module('tkinter.tix', deprecated=True)
+from tkinter import TclError
class TestTix(unittest.TestCase):
@@ -24,9 +26,12 @@ class TestTix(unittest.TestCase):
else:
self.addCleanup(self.root.destroy)
- def test_tix_available(self):
- # this test is just here to make setUp run
- pass
+ def test_tix_deprecation(self):
+ with self.assertWarns(DeprecationWarning):
+ import_helper.import_fresh_module(
+ 'tkinter.tix',
+ fresh=('tkinter.tix',),
+ )
if __name__ == '__main__':