@@ -1712,30 +1712,29 @@ class PolicyTests(unittest.TestCase):
17121712 def create_policy (self ):
17131713 return asyncio .DefaultEventLoopPolicy ()
17141714
1715- def test_get_default_child_watcher ( self ):
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 )
1715+ @ mock . patch ( 'asyncio.unix_events.can_use_pidfd' )
1716+ def test_get_default_child_watcher ( self , m_can_use_pidfd ):
1717+ m_can_use_pidfd . 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 )
17231723
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 ())
17271727
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 )
1728+ m_can_use_pidfd .return_value = True
1729+ policy = self .create_policy ()
1730+ self .assertIsNone (policy ._watcher )
1731+ with self .assertWarns (DeprecationWarning ):
1732+ watcher = policy .get_child_watcher ()
1733+ self .assertIsInstance (watcher , asyncio .PidfdChildWatcher )
17351734
1736- self .assertIs (policy ._watcher , watcher )
1737- with self .assertWarns (DeprecationWarning ):
1738- self .assertIs (watcher , policy .get_child_watcher ())
1735+ self .assertIs (policy ._watcher , watcher )
1736+ with self .assertWarns (DeprecationWarning ):
1737+ self .assertIs (watcher , policy .get_child_watcher ())
17391738
17401739 def test_get_child_watcher_after_set (self ):
17411740 policy = self .create_policy ()
0 commit comments