12
12
import threading
13
13
import unittest
14
14
from unittest import mock
15
+ import warnings
15
16
from test .support import os_helper
16
17
from test .support import socket_helper
17
18
@@ -1686,12 +1687,16 @@ def test_close(self, m_waitpid):
1686
1687
1687
1688
class SafeChildWatcherTests (ChildWatcherTestsMixin , test_utils .TestCase ):
1688
1689
def create_watcher (self ):
1689
- return asyncio .SafeChildWatcher ()
1690
+ with warnings .catch_warnings ():
1691
+ warnings .simplefilter ("ignore" , DeprecationWarning )
1692
+ return asyncio .SafeChildWatcher ()
1690
1693
1691
1694
1692
1695
class FastChildWatcherTests (ChildWatcherTestsMixin , test_utils .TestCase ):
1693
1696
def create_watcher (self ):
1694
- return asyncio .FastChildWatcher ()
1697
+ with warnings .catch_warnings ():
1698
+ warnings .simplefilter ("ignore" , DeprecationWarning )
1699
+ return asyncio .FastChildWatcher ()
1695
1700
1696
1701
1697
1702
class PolicyTests (unittest .TestCase ):
@@ -1724,7 +1729,9 @@ def test_get_default_child_watcher(self):
1724
1729
1725
1730
def test_get_child_watcher_after_set (self ):
1726
1731
policy = self .create_policy ()
1727
- watcher = asyncio .FastChildWatcher ()
1732
+ with warnings .catch_warnings ():
1733
+ warnings .simplefilter ("ignore" , DeprecationWarning )
1734
+ watcher = asyncio .FastChildWatcher ()
1728
1735
1729
1736
policy .set_child_watcher (watcher )
1730
1737
self .assertIs (policy ._watcher , watcher )
@@ -1745,7 +1752,9 @@ def f():
1745
1752
policy .get_event_loop ().close ()
1746
1753
1747
1754
policy = self .create_policy ()
1748
- policy .set_child_watcher (asyncio .SafeChildWatcher ())
1755
+ with warnings .catch_warnings ():
1756
+ warnings .simplefilter ("ignore" , DeprecationWarning )
1757
+ policy .set_child_watcher (asyncio .SafeChildWatcher ())
1749
1758
1750
1759
th = threading .Thread (target = f )
1751
1760
th .start ()
@@ -1757,7 +1766,9 @@ def test_child_watcher_replace_mainloop_existing(self):
1757
1766
1758
1767
# Explicitly setup SafeChildWatcher,
1759
1768
# default ThreadedChildWatcher has no _loop property
1760
- watcher = asyncio .SafeChildWatcher ()
1769
+ with warnings .catch_warnings ():
1770
+ warnings .simplefilter ("ignore" , DeprecationWarning )
1771
+ watcher = asyncio .SafeChildWatcher ()
1761
1772
policy .set_child_watcher (watcher )
1762
1773
watcher .attach_loop (loop )
1763
1774
0 commit comments