@@ -37,7 +37,7 @@ def context(rw_context):
37
37
38
38
39
39
# main {{{1
40
- def test_main (mocker , context , event_loop ):
40
+ def test_main (mocker , context , _function_event_loop ):
41
41
config = dict (context .config )
42
42
config ["poll_interval" ] = 1
43
43
creds = {"fake_creds" : True }
@@ -56,16 +56,16 @@ async def foo(arg, credentials):
56
56
mocker .patch .object (worker , "async_main" , new = foo )
57
57
mocker .patch .object (sys , "argv" , new = ["x" , tmp ])
58
58
with pytest .raises (ScriptWorkerException ):
59
- worker .main (event_loop = event_loop )
59
+ worker .main (event_loop = _function_event_loop )
60
60
finally :
61
61
os .remove (tmp )
62
62
63
63
64
64
@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 ):
66
66
"""Test that sending SIGTERM causes the main loop to stop after the next
67
67
call to async_main."""
68
- run_tasks_cancelled = event_loop .create_future ()
68
+ run_tasks_cancelled = _function_event_loop .create_future ()
69
69
70
70
class MockRunTasks :
71
71
@staticmethod
@@ -86,20 +86,20 @@ async def async_main(internal_context, _):
86
86
json .dump (context .config , fh )
87
87
mocker .patch .object (worker , "async_main" , new = async_main )
88
88
mocker .patch .object (sys , "argv" , new = ["x" , tmp ])
89
- worker .main (event_loop = event_loop )
89
+ worker .main (event_loop = _function_event_loop )
90
90
finally :
91
91
os .remove (tmp )
92
92
93
93
if running :
94
- event_loop .run_until_complete (run_tasks_cancelled )
94
+ _function_event_loop .run_until_complete (run_tasks_cancelled )
95
95
assert run_tasks_cancelled .result ()
96
96
97
97
98
98
@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 ):
100
100
"""Test that sending SIGUSR1 causes the main loop to stop after the next
101
101
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 ()
103
103
104
104
class MockRunTasks :
105
105
@staticmethod
@@ -120,7 +120,7 @@ async def async_main(internal_context, _):
120
120
json .dump (context .config , fh )
121
121
mocker .patch .object (worker , "async_main" , new = async_main )
122
122
mocker .patch .object (sys , "argv" , new = ["x" , tmp ])
123
- worker .main (event_loop = event_loop )
123
+ worker .main (event_loop = _function_event_loop )
124
124
finally :
125
125
os .remove (tmp )
126
126
0 commit comments