Commit b2d7bac 1 parent 4a88693 commit b2d7bac Copy full SHA for b2d7bac
File tree 1 file changed +6
-120
lines changed
1 file changed +6
-120
lines changed Original file line number Diff line number Diff line change @@ -144,129 +144,15 @@ def test_pending_priority(self):
144
144
late = time () + 100000
145
145
early = time () + 1
146
146
147
- expect = [
148
- {
149
- "path" : [],
150
- "action" : "setitem" ,
151
- "value" : {
152
- "repo_msg" : None ,
153
- "priority" : low_priority ,
154
- "pipeline" : "main" ,
155
- "due_date" : None ,
156
- "status" : "pending" ,
157
- "expid" : expid_bg ,
158
- "flush" : False
159
- },
160
- "key" : 0
161
- },
162
- {
163
- "path" : [],
164
- "action" : "setitem" ,
165
- "value" : {
166
- "repo_msg" : None ,
167
- "priority" : high_priority ,
168
- "pipeline" : "main" ,
169
- "due_date" : late ,
170
- "status" : "pending" ,
171
- "expid" : expid_empty ,
172
- "flush" : False
173
- },
174
- "key" : 1
175
- },
176
- {
177
- "path" : [],
178
- "action" : "setitem" ,
179
- "value" : {
180
- "repo_msg" : None ,
181
- "priority" : middle_priority ,
182
- "pipeline" : "main" ,
183
- "due_date" : early ,
184
- "status" : "pending" ,
185
- "expid" : expid_empty ,
186
- "flush" : False
187
- },
188
- "key" : 2
189
- },
190
- {
191
- "path" : [0 ],
192
- "action" : "setitem" ,
193
- "value" : "preparing" ,
194
- "key" : "status"
195
- },
196
- {
197
- "path" : [0 ],
198
- "action" : "setitem" ,
199
- "value" : "prepare_done" ,
200
- "key" : "status"
201
- },
202
- {
203
- "path" : [0 ],
204
- "action" : "setitem" ,
205
- "value" : "running" ,
206
- "key" : "status"
207
- },
208
- {
209
- "path" : [2 ],
210
- "action" : "setitem" ,
211
- "value" : "preparing" ,
212
- "key" : "status"
213
- },
214
- {
215
- "path" : [2 ],
216
- "action" : "setitem" ,
217
- "value" : "prepare_done" ,
218
- "key" : "status"
219
- },
220
- {
221
- "path" : [0 ],
222
- "action" : "setitem" ,
223
- "value" : "paused" ,
224
- "key" : "status"
225
- },
226
- {
227
- "path" : [2 ],
228
- "action" : "setitem" ,
229
- "value" : "running" ,
230
- "key" : "status"
231
- },
232
- {
147
+ middle_priority_done = asyncio .Event ()
148
+ def notify (mod ):
149
+ if mod == {
233
150
"path" : [2 ],
234
151
"action" : "setitem" ,
235
152
"value" : "run_done" ,
236
153
"key" : "status"
237
- },
238
- {
239
- "path" : [0 ],
240
- "action" : "setitem" ,
241
- "value" : "running" ,
242
- "key" : "status"
243
- },
244
- {
245
- "path" : [2 ],
246
- "action" : "setitem" ,
247
- "value" : "analyzing" ,
248
- "key" : "status"
249
- },
250
- {
251
- "path" : [2 ],
252
- "action" : "setitem" ,
253
- "value" : "deleting" ,
254
- "key" : "status"
255
- },
256
- {
257
- "path" : [],
258
- "action" : "delitem" ,
259
- "key" : 2
260
- },
261
- ]
262
- done = asyncio .Event ()
263
- expect_idx = 0
264
- def notify (mod ):
265
- nonlocal expect_idx
266
- self .assertEqual (mod , expect [expect_idx ])
267
- expect_idx += 1
268
- if expect_idx >= len (expect ):
269
- done .set ()
154
+ }:
155
+ middle_priority_done .set ()
270
156
scheduler .notifier .publish = notify
271
157
272
158
scheduler .start (loop = loop )
@@ -275,7 +161,7 @@ def notify(mod):
275
161
scheduler .submit ("main" , expid_empty , high_priority , late )
276
162
scheduler .submit ("main" , expid_empty , middle_priority , early )
277
163
278
- loop .run_until_complete (done .wait ())
164
+ loop .run_until_complete (middle_priority_done .wait ())
279
165
scheduler .notifier .publish = None
280
166
loop .run_until_complete (scheduler .stop ())
281
167
You can’t perform that action at this time.
0 commit comments