diff options
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 23fe2d3..c51de6f 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -32,6 +32,9 @@ from test import support # on platforms known to behave badly. platforms_to_skip = ('netbsd5', 'hp-ux11') +# Is Python built with Py_DEBUG macro defined? +Py_DEBUG = hasattr(sys, 'gettotalrefcount') + def restore_default_excepthook(testcase): testcase.addCleanup(setattr, threading, 'excepthook', threading.excepthook) @@ -915,6 +918,16 @@ class ThreadTests(BaseTestCase): threading.Thread(target=noop).start() # Thread.join() is not called + @unittest.skipUnless(Py_DEBUG, 'need debug build (Py_DEBUG)') + def test_debug_deprecation(self): + # bpo-44584: The PYTHONTHREADDEBUG environment variable is deprecated + rc, out, err = assert_python_ok("-Wdefault", "-c", "pass", + PYTHONTHREADDEBUG="1") + msg = (b'DeprecationWarning: The threading debug ' + b'(PYTHONTHREADDEBUG environment variable) ' + b'is deprecated and will be removed in Python 3.12') + self.assertIn(msg, err) + class ThreadJoinOnShutdown(BaseTestCase): |