MCPcopy Index your code
hub / github.com/python/cpython / test_old_threading_api

Method test_old_threading_api

Lib/test/test_threading.py:656–685  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

654 sys.getrefcount(weak_raising_cyclic_object())))
655
656 def test_old_threading_api(self):
657 # Just a quick sanity check to make sure the old method names are
658 # still present
659 t = threading.Thread()
660 with self.assertWarnsRegex(DeprecationWarning,
661 r'get the daemon attribute'):
662 t.isDaemon()
663 with self.assertWarnsRegex(DeprecationWarning,
664 r'set the daemon attribute'):
665 t.setDaemon(True)
666 with self.assertWarnsRegex(DeprecationWarning,
667 r'get the name attribute'):
668 t.getName()
669 with self.assertWarnsRegex(DeprecationWarning,
670 r'set the name attribute'):
671 t.setName("name")
672
673 e = threading.Event()
674 with self.assertWarnsRegex(DeprecationWarning, 'use is_set()'):
675 e.isSet()
676
677 cond = threading.Condition()
678 cond.acquire()
679 with self.assertWarnsRegex(DeprecationWarning, 'use notify_all()'):
680 cond.notifyAll()
681
682 with self.assertWarnsRegex(DeprecationWarning, 'use active_count()'):
683 threading.activeCount()
684 with self.assertWarnsRegex(DeprecationWarning, 'use current_thread()'):
685 threading.currentThread()
686
687 def test_repr_daemon(self):
688 t = threading.Thread()

Callers

nothing calls this directly

Calls 10

isDaemonMethod · 0.95
setDaemonMethod · 0.95
getNameMethod · 0.95
setNameMethod · 0.95
isSetMethod · 0.95
notifyAllMethod · 0.95
assertWarnsRegexMethod · 0.80
EventMethod · 0.80
ConditionMethod · 0.45
acquireMethod · 0.45

Tested by

no test coverage detected