Skip to content

test_conf_daily_short_range_init23 test fails around 23 and 00Z #63

@quinnylee

Description

@quinnylee

When test_conf_daily_short_range_init23() in test_configuration.py runs around 23 - 00 UTC, it fails with this error:

> assert start.day == (datetime.now(timezone.utc)).day or start.day == (datetime.now(timezone.utc) - timedelta(days=1)).day 
E assert (13 == 12 or 13 == 11) E + where 13 = datetime.datetime(2026, 2, 13, 0, 0).day 
E + and 12 = datetime.datetime(2026, 2, 12, 23, 0, 53, 606823, tzinfo=datetime.timezone.utc).day 
E + where datetime.datetime(2026, 2, 12, 23, 0, 53, 606823, tzinfo=datetime.timezone.utc) = <built-in method now of type object at 0x7fb43cc8b000>(datetime.timezone.utc) 
E + where <built-in method now of type object at 0x7fb43cc8b000> = datetime.now 
E + and datetime.timezone.utc = timezone.utc 
E + and 13 = datetime.datetime(2026, 2, 13, 0, 0).day 
E + and 11 = (datetime.datetime(2026, 2, 12, 23, 0, 53, 606825, tzinfo=datetime.timezone.utc) - datetime.timedelta(days=1)).day 
E + where datetime.datetime(2026, 2, 12, 23, 0, 53, 606825, tzinfo=datetime.timezone.utc) = <built-in method now of type object at 0x7fb43cc8b000>(datetime.timezone.utc) 
E + where <built-in method now of type object at 0x7fb43cc8b000> = datetime.now 
E + and datetime.timezone.utc = timezone.utc 
E + and datetime.timedelta(days=1) = timedelta(days=1)

The issue seems to be that this time shift block at https://github.com/CIROH-UA/datastreamcli/blob/main/src/datastreamcli/configure_datastream.py#L222 never gets triggered when the UTC time is hour 23

# apply a time shift if the requested init hour is after the current hour in utc, if so, date shift a day
        if "DAILY" in start and start_dt_exact.hour < fcst_cycle and args.end_date == "":
            start_str_real = datetime.strftime(datetime.strptime(start_str_real,'%Y-%m-%d %H:%M:%S') - timedelta(days=1),'%Y-%m-%d %H:%M:%S')
            end_str_real = datetime.strftime(datetime.strptime(end_str_real,'%Y-%m-%d %H:%M:%S') - timedelta(days=1),'%Y-%m-%d %H:%M:%S')
            start_str_nwm = datetime.strftime(datetime.strptime(start_str_nwm,'%Y%m%d%H%M') - timedelta(days=1),'%Y%m%d%H%M')
            end_str_nwm = datetime.strftime(datetime.strptime(end_str_nwm,'%Y%m%d%H%M') - timedelta(days=1),'%Y%m%d%H%M')

Metadata

Metadata

Labels

CI/CDRelated to Continuous Integration and Delivery/DeploymentbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions