@@ -122,15 +122,15 @@ def test_default_affinity():
122
122
api = mock_k8s_api ,
123
123
name = "test_build" ,
124
124
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 ),
131
131
git_credentials = None ,
132
132
docker_host = "http://mydockerregistry.local" ,
133
- node_selector = mock .MagicMock (),
133
+ node_selector = mock .MagicMock (spec = dict ),
134
134
)
135
135
136
136
affinity = build .get_affinity ()
@@ -150,15 +150,15 @@ def test_sticky_builds_affinity():
150
150
api = mock_k8s_api ,
151
151
name = "test_build" ,
152
152
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 ),
159
159
git_credentials = None ,
160
160
docker_host = "http://mydockerregistry.local" ,
161
- node_selector = mock .MagicMock (),
161
+ node_selector = mock .MagicMock (spec = dict ),
162
162
sticky_builds = True ,
163
163
)
164
164
@@ -188,15 +188,15 @@ def test_git_credentials_passed_to_podspec_upon_submit():
188
188
api = mock_k8s_api ,
189
189
name = "test_build" ,
190
190
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 ),
193
193
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 ),
198
198
docker_host = "http://mydockerregistry.local" ,
199
- node_selector = mock .MagicMock (),
199
+ node_selector = mock .MagicMock (spec = dict ),
200
200
)
201
201
202
202
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():
215
215
assert env ["GIT_CREDENTIAL_ENV" ] == git_credentials
216
216
217
217
218
- async def test_local_repo2docker_build ():
218
+ async def test_local_repo2docker_build (io_loop ):
219
219
q = Queue ()
220
220
repo_url = "https://github.com/binderhub-ci-repos/cached-minimal-dockerfile"
221
221
ref = "HEAD"
@@ -227,6 +227,7 @@ async def test_local_repo2docker_build():
227
227
repo_url = repo_url ,
228
228
ref = ref ,
229
229
image_name = name ,
230
+ main_loop = io_loop ,
230
231
)
231
232
build .submit ()
232
233
@@ -246,7 +247,7 @@ async def test_local_repo2docker_build():
246
247
247
248
248
249
@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 ):
250
251
q = Queue ()
251
252
# We need a slow build here so that we can interrupt it, so pick a large repo that
252
253
# will take several seconds to clone
@@ -260,8 +261,9 @@ async def test_local_repo2docker_build_stop(event_loop):
260
261
repo_url = repo_url ,
261
262
ref = ref ,
262
263
image_name = name ,
264
+ main_loop = io_loop ,
263
265
)
264
- event_loop .run_in_executor (None , build .submit )
266
+ io_loop .run_in_executor (None , build .submit )
265
267
266
268
# Get first few log messages to check it successfully stared
267
269
event = await q .get ()
0 commit comments