Skip to content

Commit a4c462f

Browse files
tests/i: remove sleep (#6212)
Replace a sleep with a call to update the database.
1 parent 87ef3a0 commit a4c462f

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

tests/integration/test_dbstatecheck.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
"""Tests for the backend method of workflow_state"""
1818

19-
20-
from asyncio import sleep
2119
import pytest
22-
from textwrap import dedent
2320

2421
from cylc.flow.dbstatecheck import CylcWorkflowDBChecker
2522
from cylc.flow.scheduler import Scheduler
@@ -36,13 +33,15 @@ async def checker(
3633
"""
3734
wid = mod_flow({
3835
'scheduling': {
39-
'graph': {'P1Y': dedent('''
40-
good:succeeded
41-
bad:failed?
42-
output:custom_output
43-
''')},
4436
'initial cycle point': '1000',
45-
'final cycle point': '1001'
37+
'final cycle point': '1001',
38+
'graph': {
39+
'P1Y': '''
40+
good:succeeded
41+
bad:failed?
42+
output:custom_output
43+
'''
44+
},
4645
},
4746
'runtime': {
4847
'bad': {'simulation': {'fail cycle points': '1000'}},
@@ -51,11 +50,17 @@ async def checker(
5150
})
5251
schd: Scheduler = mod_scheduler(wid, paused_start=False)
5352
async with mod_run(schd):
53+
# allow a cycle of the main loop to pass so that flow 2 can be
54+
# added to db
5455
await mod_complete(schd)
56+
57+
# trigger a new task in flow 2
5558
schd.pool.force_trigger_tasks(['1000/good'], ['2'])
56-
# Allow a cycle of the main loop to pass so that flow 2 can be
57-
# added to db
58-
await sleep(1)
59+
60+
# update the database
61+
schd.process_workflow_db_queue()
62+
63+
# yield a DB checker
5964
with CylcWorkflowDBChecker(
6065
'somestring', 'utterbunkum', schd.workflow_db_mgr.pub_path
6166
) as _checker:

0 commit comments

Comments
 (0)