@@ -191,6 +191,7 @@ def _test_1_happy_path(self):
191
191
# run Step 1, it will succeed
192
192
# ----------------------------------------------------------------------
193
193
utc_now = get_utc_now ()
194
+ time .sleep (0.001 )
194
195
195
196
# create a new task
196
197
step1 = Step1 .make_and_save (task_id = task_id , data = {"version" : 0 })
@@ -261,6 +262,7 @@ def _test_1_happy_path(self):
261
262
assert step2 .is_locked () is False
262
263
263
264
utc_now = get_utc_now ()
265
+ time .sleep (0.001 )
264
266
265
267
with pytest .raises (UserError ):
266
268
with Step2 .start (task_id , debug = False ) as exec_ctx :
@@ -302,6 +304,7 @@ def _test_1_happy_path(self):
302
304
# run Step 2 again, it will succeeded this time
303
305
# ----------------------------------------------------------------------
304
306
utc_now = get_utc_now ()
307
+ time .sleep (0.001 )
305
308
306
309
with Step2 .start (task_id , debug = False ) as exec_ctx :
307
310
exec_ctx .set_data ({"version" : 2 })
@@ -366,6 +369,7 @@ def _test_2_lock_mechanism(self):
366
369
367
370
# check the database side updated task
368
371
utc_now_1 = get_utc_now ()
372
+ time .sleep (0.001 )
369
373
step1 = Step1 .get_one_or_none (task_id = task_id )
370
374
# check if the task status is "in_progress",
371
375
# because another worker is working on it
@@ -389,6 +393,7 @@ def _test_3_retry_and_ignore(self):
389
393
# run Step 1 three times, and all of them failed, and it reaches ignored status
390
394
# ----------------------------------------------------------------------
391
395
utc_now = get_utc_now ()
396
+ time .sleep (0.001 )
392
397
exec_ctx : ExecutionContext
393
398
with pytest .raises (UserError ):
394
399
with Step1 .start (task_id , debug = False ) as exec_ctx :
0 commit comments