File tree Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Expand file tree Collapse file tree 3 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -208,10 +208,12 @@ def _call(*args, **kwargs):
208208@pytest .fixture
209209def 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
Original file line number Diff line number Diff line change 1717from datetime import datetime , timedelta
1818import pytest
1919import sqlite3
20+ import time
2021from typing import TYPE_CHECKING
2122
2223from 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:
Original file line number Diff line number Diff 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'
You can’t perform that action at this time.
0 commit comments