@@ -122,15 +122,15 @@ def test_default_affinity():
122122 api = mock_k8s_api ,
123123 name = "test_build" ,
124124 namespace = "build_namespace" ,
125- repo_url = mock .MagicMock (),
126- ref = mock .MagicMock (),
127- build_image = mock .MagicMock (),
128- image_name = mock .MagicMock (),
129- push_secret = mock .MagicMock (),
130- memory_limit = mock .MagicMock (),
125+ repo_url = mock .MagicMock (spec = str ),
126+ ref = mock .MagicMock (spec = str ),
127+ build_image = mock .MagicMock (spec = str ),
128+ image_name = mock .MagicMock (spec = str ),
129+ push_secret = mock .MagicMock (spec = str ),
130+ memory_limit = mock .MagicMock (spec = int ),
131131 git_credentials = None ,
132132 docker_host = "http://mydockerregistry.local" ,
133- node_selector = mock .MagicMock (),
133+ node_selector = mock .MagicMock (spec = dict ),
134134 )
135135
136136 affinity = build .get_affinity ()
@@ -150,15 +150,15 @@ def test_sticky_builds_affinity():
150150 api = mock_k8s_api ,
151151 name = "test_build" ,
152152 namespace = "build_namespace" ,
153- repo_url = mock .MagicMock (),
154- ref = mock .MagicMock (),
155- build_image = mock .MagicMock (),
156- image_name = mock .MagicMock (),
157- push_secret = mock .MagicMock (),
158- memory_limit = mock .MagicMock (),
153+ repo_url = mock .MagicMock (spec = str ),
154+ ref = mock .MagicMock (spec = str ),
155+ build_image = mock .MagicMock (spec = str ),
156+ image_name = mock .MagicMock (spec = str ),
157+ push_secret = mock .MagicMock (spec = str ),
158+ memory_limit = mock .MagicMock (spec = int ),
159159 git_credentials = None ,
160160 docker_host = "http://mydockerregistry.local" ,
161- node_selector = mock .MagicMock (),
161+ node_selector = mock .MagicMock (spec = dict ),
162162 sticky_builds = True ,
163163 )
164164
@@ -188,15 +188,15 @@ def test_git_credentials_passed_to_podspec_upon_submit():
188188 api = mock_k8s_api ,
189189 name = "test_build" ,
190190 namespace = "build_namespace" ,
191- repo_url = mock .MagicMock (),
192- ref = mock .MagicMock (),
191+ repo_url = mock .MagicMock (spec = str ),
192+ ref = mock .MagicMock (spec = str ),
193193 git_credentials = git_credentials ,
194- build_image = mock .MagicMock (),
195- image_name = mock .MagicMock (),
196- push_secret = mock .MagicMock (),
197- memory_limit = mock .MagicMock (),
194+ build_image = mock .MagicMock (spec = str ),
195+ image_name = mock .MagicMock (spec = str ),
196+ push_secret = mock .MagicMock (spec = str ),
197+ memory_limit = mock .MagicMock (spec = int ),
198198 docker_host = "http://mydockerregistry.local" ,
199- node_selector = mock .MagicMock (),
199+ node_selector = mock .MagicMock (spec = dict ),
200200 )
201201
202202 with mock .patch .object (build .stop_event , "is_set" , return_value = True ):
@@ -215,7 +215,7 @@ def test_git_credentials_passed_to_podspec_upon_submit():
215215 assert env ["GIT_CREDENTIAL_ENV" ] == git_credentials
216216
217217
218- async def test_local_repo2docker_build ():
218+ async def test_local_repo2docker_build (io_loop ):
219219 q = Queue ()
220220 repo_url = "https://github.com/binderhub-ci-repos/cached-minimal-dockerfile"
221221 ref = "HEAD"
@@ -227,6 +227,7 @@ async def test_local_repo2docker_build():
227227 repo_url = repo_url ,
228228 ref = ref ,
229229 image_name = name ,
230+ main_loop = io_loop ,
230231 )
231232 build .submit ()
232233
@@ -246,7 +247,7 @@ async def test_local_repo2docker_build():
246247
247248
248249@pytest .mark .asyncio (timeout = 20 )
249- async def test_local_repo2docker_build_stop (event_loop ):
250+ async def test_local_repo2docker_build_stop (io_loop ):
250251 q = Queue ()
251252 # We need a slow build here so that we can interrupt it, so pick a large repo that
252253 # will take several seconds to clone
@@ -260,8 +261,9 @@ async def test_local_repo2docker_build_stop(event_loop):
260261 repo_url = repo_url ,
261262 ref = ref ,
262263 image_name = name ,
264+ main_loop = io_loop ,
263265 )
264- event_loop .run_in_executor (None , build .submit )
266+ io_loop .run_in_executor (None , build .submit )
265267
266268 # Get first few log messages to check it successfully stared
267269 event = await q .get ()
0 commit comments