Skip to content

Commit 56be9d1

Browse files
committed
rewrote test in a less resource intensive way
1 parent 5728bfa commit 56be9d1

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,12 @@ def _call(*args, **kwargs):
208208
@pytest.fixture
209209
def set_nonexistent_timezone(monkeypatch):
210210
"""Fixture to temporarily set a non-existent time zone."""
211-
try:
211+
def patch():
212212
with monkeypatch.context() as mp:
213213
mp.setenv('TZ', 'XXX-19:17') # Set to a non-existent time zone
214214
time.tzset()
215-
yield
215+
216+
try:
217+
yield patch
216218
finally:
217219
time.tzset() # Reset to the original time zone after the test

tests/integration/test_workflow_db_mgr.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from datetime import datetime, timedelta
1818
import pytest
1919
import sqlite3
20+
import time
2021
from typing import TYPE_CHECKING
2122

2223
from cylc.flow import commands
@@ -185,19 +186,21 @@ async def test_time_zone_writing(
185186
one_conf,
186187
flow,
187188
scheduler,
188-
run,
189-
complete,
190-
set_nonexistent_timezone,
189+
start,
191190
db_select,
191+
set_nonexistent_timezone
192192
):
193193
"""Don't store scheduler startup timezone forever.
194194
195195
https://github.com/cylc/cylc-flow/issues/6701
196196
"""
197197
wid = flow(one_conf)
198198
schd = scheduler(wid, paused_start=False, run_mode='live')
199-
async with run(schd):
200-
await complete(schd, timeout=20)
199+
async with start(schd):
200+
itask = schd.pool.get_tasks()[0]
201+
schd.submit_task_jobs([itask])
202+
set_nonexistent_timezone()
203+
schd.task_events_mgr.process_message(itask, 'INFO', 'submitted')
201204

202205
# Check the db time_submit (defective) against time_submit_exit
203206
# which was ok:

tests/unit/test_wallclock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@ def test_get_current_time_string(set_nonexistent_timezone):
7070
7171
https://github.com/cylc/cylc-flow/issues/6701
7272
"""
73+
set_nonexistent_timezone()
7374
res = get_current_time_string()
7475
assert res[-6:] == '+19:17'

0 commit comments

Comments
 (0)