@@ -37,7 +37,7 @@ def context(rw_context):
3737
3838
3939# main {{{1
40- def test_main (mocker , context , event_loop ):
40+ def test_main (mocker , context , _function_event_loop ):
4141 config = dict (context .config )
4242 config ["poll_interval" ] = 1
4343 creds = {"fake_creds" : True }
@@ -56,16 +56,16 @@ async def foo(arg, credentials):
5656 mocker .patch .object (worker , "async_main" , new = foo )
5757 mocker .patch .object (sys , "argv" , new = ["x" , tmp ])
5858 with pytest .raises (ScriptWorkerException ):
59- worker .main (event_loop = event_loop )
59+ worker .main (event_loop = _function_event_loop )
6060 finally :
6161 os .remove (tmp )
6262
6363
6464@pytest .mark .parametrize ("running" , (True , False ))
65- def test_main_running_sigterm (mocker , context , event_loop , running ):
65+ def test_main_running_sigterm (mocker , context , _function_event_loop , running ):
6666 """Test that sending SIGTERM causes the main loop to stop after the next
6767 call to async_main."""
68- run_tasks_cancelled = event_loop .create_future ()
68+ run_tasks_cancelled = _function_event_loop .create_future ()
6969
7070 class MockRunTasks :
7171 @staticmethod
@@ -86,20 +86,20 @@ async def async_main(internal_context, _):
8686 json .dump (context .config , fh )
8787 mocker .patch .object (worker , "async_main" , new = async_main )
8888 mocker .patch .object (sys , "argv" , new = ["x" , tmp ])
89- worker .main (event_loop = event_loop )
89+ worker .main (event_loop = _function_event_loop )
9090 finally :
9191 os .remove (tmp )
9292
9393 if running :
94- event_loop .run_until_complete (run_tasks_cancelled )
94+ _function_event_loop .run_until_complete (run_tasks_cancelled )
9595 assert run_tasks_cancelled .result ()
9696
9797
9898@pytest .mark .parametrize ("running" , (True , False ))
99- def test_main_running_sigusr1 (mocker , context , event_loop , running ):
99+ def test_main_running_sigusr1 (mocker , context , _function_event_loop , running ):
100100 """Test that sending SIGUSR1 causes the main loop to stop after the next
101101 call to async_main without cancelling the task."""
102- run_tasks_cancelled = event_loop .create_future ()
102+ run_tasks_cancelled = _function_event_loop .create_future ()
103103
104104 class MockRunTasks :
105105 @staticmethod
@@ -120,7 +120,7 @@ async def async_main(internal_context, _):
120120 json .dump (context .config , fh )
121121 mocker .patch .object (worker , "async_main" , new = async_main )
122122 mocker .patch .object (sys , "argv" , new = ["x" , tmp ])
123- worker .main (event_loop = event_loop )
123+ worker .main (event_loop = _function_event_loop )
124124 finally :
125125 os .remove (tmp )
126126
0 commit comments