mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
make test_threading more robust for real
This commit is contained in:
parent
47bc809578
commit
fa1e21cf96
1 changed files with 1 additions and 3 deletions
|
@ -324,14 +324,12 @@ class ThreadTests(unittest.TestCase):
|
||||||
sys.getrefcount(weak_raising_cyclic_object())))
|
sys.getrefcount(weak_raising_cyclic_object())))
|
||||||
|
|
||||||
def test_pep8ified_threading(self):
|
def test_pep8ified_threading(self):
|
||||||
import warnings
|
|
||||||
|
|
||||||
def check(_, w, msg):
|
def check(_, w, msg):
|
||||||
self.assertEqual(str(w.message), msg)
|
self.assertEqual(str(w.message), msg)
|
||||||
|
|
||||||
t = threading.Thread()
|
t = threading.Thread()
|
||||||
with catch_warning() as w:
|
with catch_warning() as w:
|
||||||
warnings.simplefilter("always", DeprecationWarning)
|
del threading.__warningregistry__
|
||||||
msg = "isDaemon() is deprecated in favor of the " \
|
msg = "isDaemon() is deprecated in favor of the " \
|
||||||
"Thread.daemon property"
|
"Thread.daemon property"
|
||||||
check(t.isDaemon(), w, msg)
|
check(t.isDaemon(), w, msg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue