CIROH-UA / CIROH-UA/datastreamcli
test_conf_daily_short_range_init23 test fails around 23 and 00Z
- Dominant language
- Python
- Stars
- 3
- Forks
- 6
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 4
Description
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) = (datetime.timezone.utc)
E + where = 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) = (datetime.timezone.utc)
E + where = 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')
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.