Skip to content

Use UTC date in default flight dates test (fails locally every US evening)#106

Merged
therevoltingx merged 1 commit into
IABTechLab:mainfrom
aleksUIX:fix-utc-date-in-default-flight-dates-test
Jul 15, 2026
Merged

Use UTC date in default flight dates test (fails locally every US evening)#106
therevoltingx merged 1 commit into
IABTechLab:mainfrom
aleksUIX:fix-utc-date-in-default-flight-dates-test

Conversation

@aleksUIX

@aleksUIX aleksUIX commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

test_deal_uses_default_flight_dates compares a local-time date against output the code builds in UTC, so the suite fails every evening for anyone west of UTC. One-line fix aligning the test with the code's own timezone discipline.

Details

  • The test asserted datetime.now().strftime("%Y-%m-%d") (naive local time) appears in RequestDealTool output.
  • Production code builds those dates with datetime.now(UTC) (src/ad_buyer/tools/buyer_deals/request_deal.py).
  • Whenever local date != UTC date (roughly 4pm to midnight in US timezones), the assertion fails. CI runners are UTC, so CI never catches it.

Reproduced on a clean checkout at 20:45 PDT on 2026-07-05 (UTC date was already 2026-07-06):

E       assert '2026-07-05' in "...DEAL CREATED SUCCESSFULLY..."
tests/unit/test_buyer_deal_discovery_pricing.py:774: AssertionError
1 failed, 3302 passed, 65 skipped

This is the only naive datetime.now() in the test suite (grep confirms).

Verification

After the change, all 98 tests in the file pass regardless of local timezone; ruff check and ruff format --check clean.

test_deal_uses_default_flight_dates compared local-time
datetime.now() against output that request_deal.py builds with
datetime.now(UTC). The test fails whenever the local date differs
from the UTC date, which for US timezones is every evening from
about 4pm until midnight. CI never sees it because runners are UTC.

Reproduced at 20:45 PDT on 2026-07-05 (UTC date already 2026-07-06):
the suite reports 1 failed, 3302 passed. With the test aligned to
the UTC discipline the code under test already uses, the file's 98
tests pass at any hour.
@therevoltingx
therevoltingx merged commit 0de224d into IABTechLab:main Jul 15, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants