@@ -1713,29 +1713,29 @@ def create_policy(self):
1713
1713
return asyncio .DefaultEventLoopPolicy ()
1714
1714
1715
1715
def test_get_default_child_watcher (self ):
1716
- policy = self . create_policy ()
1717
- self . assertIsNone ( policy . _watcher )
1718
- unix_events . can_use_pidfd = mock . Mock ()
1719
- unix_events . can_use_pidfd . return_value = False
1720
- with self .assertWarns (DeprecationWarning ):
1721
- watcher = policy .get_child_watcher ()
1722
- self .assertIsInstance (watcher , asyncio .ThreadedChildWatcher )
1716
+ with mock . patch ( 'asyncio.unix_events.can_use_pidfd' ,
1717
+ return_value = False ):
1718
+ policy = self . create_policy ()
1719
+ self . assertIsNone ( policy . _watcher )
1720
+ with self .assertWarns (DeprecationWarning ):
1721
+ watcher = policy .get_child_watcher ()
1722
+ self .assertIsInstance (watcher , asyncio .ThreadedChildWatcher )
1723
1723
1724
- self .assertIs (policy ._watcher , watcher )
1725
- with self .assertWarns (DeprecationWarning ):
1726
- self .assertIs (watcher , policy .get_child_watcher ())
1724
+ self .assertIs (policy ._watcher , watcher )
1725
+ with self .assertWarns (DeprecationWarning ):
1726
+ self .assertIs (watcher , policy .get_child_watcher ())
1727
1727
1728
- policy = self . create_policy ()
1729
- self . assertIsNone ( policy . _watcher )
1730
- unix_events . can_use_pidfd = mock . Mock ()
1731
- unix_events . can_use_pidfd . return_value = True
1732
- with self .assertWarns (DeprecationWarning ):
1733
- watcher = policy .get_child_watcher ()
1734
- self .assertIsInstance (watcher , asyncio .PidfdChildWatcher )
1728
+ with mock . patch ( 'asyncio.unix_events.can_use_pidfd' ,
1729
+ return_value = True ):
1730
+ policy = self . create_policy ()
1731
+ self . assertIsNone ( policy . _watcher )
1732
+ with self .assertWarns (DeprecationWarning ):
1733
+ watcher = policy .get_child_watcher ()
1734
+ self .assertIsInstance (watcher , asyncio .PidfdChildWatcher )
1735
1735
1736
- self .assertIs (policy ._watcher , watcher )
1737
- with self .assertWarns (DeprecationWarning ):
1738
- self .assertIs (watcher , policy .get_child_watcher ())
1736
+ self .assertIs (policy ._watcher , watcher )
1737
+ with self .assertWarns (DeprecationWarning ):
1738
+ self .assertIs (watcher , policy .get_child_watcher ())
1739
1739
1740
1740
def test_get_child_watcher_after_set (self ):
1741
1741
policy = self .create_policy ()
0 commit comments