Skip to content

Commit 68742be

Browse files
committed
fix test
1 parent e10d362 commit 68742be

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/patterns/test_status_tracker.py

+5
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def _test_1_happy_path(self):
191191
# run Step 1, it will succeed
192192
# ----------------------------------------------------------------------
193193
utc_now = get_utc_now()
194+
time.sleep(0.001)
194195

195196
# create a new task
196197
step1 = Step1.make_and_save(task_id=task_id, data={"version": 0})
@@ -261,6 +262,7 @@ def _test_1_happy_path(self):
261262
assert step2.is_locked() is False
262263

263264
utc_now = get_utc_now()
265+
time.sleep(0.001)
264266

265267
with pytest.raises(UserError):
266268
with Step2.start(task_id, debug=False) as exec_ctx:
@@ -302,6 +304,7 @@ def _test_1_happy_path(self):
302304
# run Step 2 again, it will succeeded this time
303305
# ----------------------------------------------------------------------
304306
utc_now = get_utc_now()
307+
time.sleep(0.001)
305308

306309
with Step2.start(task_id, debug=False) as exec_ctx:
307310
exec_ctx.set_data({"version": 2})
@@ -366,6 +369,7 @@ def _test_2_lock_mechanism(self):
366369

367370
# check the database side updated task
368371
utc_now_1 = get_utc_now()
372+
time.sleep(0.001)
369373
step1 = Step1.get_one_or_none(task_id=task_id)
370374
# check if the task status is "in_progress",
371375
# because another worker is working on it
@@ -389,6 +393,7 @@ def _test_3_retry_and_ignore(self):
389393
# run Step 1 three times, and all of them failed, and it reaches ignored status
390394
# ----------------------------------------------------------------------
391395
utc_now = get_utc_now()
396+
time.sleep(0.001)
392397
exec_ctx: ExecutionContext
393398
with pytest.raises(UserError):
394399
with Step1.start(task_id, debug=False) as exec_ctx:

0 commit comments

Comments
 (0)