diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-08-18 21:53:29 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-08-18 21:53:29 +0000 |
commit | 6ee1a31e9ba8c7e1ad33ed65440a9626886df345 (patch) | |
tree | 0aa90d08a0540a54b8c709fb58b3b6422359a072 /Lib/test/test_py3kwarn.py | |
parent | 351ffb80c3fffc2996cc320fd9e0eaf3778eba25 (diff) | |
download | cpython-git-6ee1a31e9ba8c7e1ad33ed65440a9626886df345.tar.gz |
add py3k warnings for old threading APIs
they will still live in 3.0 but it can't hurt
Diffstat (limited to 'Lib/test/test_py3kwarn.py')
-rw-r--r-- | Lib/test/test_py3kwarn.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index 0dac3d043d..274e147167 100644 --- a/Lib/test/test_py3kwarn.py +++ b/Lib/test/test_py3kwarn.py @@ -250,6 +250,40 @@ class TestPy3KWarnings(unittest.TestCase): def __hash__(self): pass self.assertEqual(len(w.warnings), 0) + def test_pep8ified_threading(self): + import threading + + t = threading.Thread() + with catch_warning() as w: + msg = "isDaemon() is deprecated in favor of the " \ + "Thread.daemon property" + self.assertWarning(t.isDaemon(), w, msg) + w.reset() + msg = "setDaemon() is deprecated in favor of the " \ + "Thread.daemon property" + self.assertWarning(t.setDaemon(True), w, msg) + w.reset() + msg = "getName() is deprecated in favor of the " \ + "Thread.name property" + self.assertWarning(t.getName(), w, msg) + w.reset() + msg = "setName() is deprecated in favor of the " \ + "Thread.name property" + self.assertWarning(t.setName("name"), w, msg) + w.reset() + msg = "isAlive() is deprecated in favor of is_alive()" + self.assertWarning(t.isAlive(), w, msg) + w.reset() + e = threading.Event() + msg = "isSet() is deprecated in favor of is_set()" + self.assertWarning(e.isSet(), w, msg) + w.reset() + msg = "currentThread() is deprecated in favor of current_thread()" + self.assertWarning(threading.currentThread(), w, msg) + w.reset() + msg = "activeCount() is deprecated in favor of active_count()" + self.assertWarning(threading.activeCount(), w, msg) + class TestStdlibRemovals(unittest.TestCase): |