Fix timezone-dependent symlink test in TestFileProcessorHandler#68910
Open
shreyamalviya wants to merge 1 commit into
Open
Fix timezone-dependent symlink test in TestFileProcessorHandler#68910shreyamalviya wants to merge 1 commit into
shreyamalviya wants to merge 1 commit into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On running the unit tests,
test_symlink_latest_log_directorywas failing for me because of a timezone issue (I'm in BST/UTC+1).The tests compute the expected log-directory name from
timezone.utcnow()but then travel to that date with a naive date string:time_machine.travel("2026-06-24", ...).time_machineinterprets a naive datetime as local time, so under a positive UTC offset, the travel target lands on the previous day in UTC (2026-06-24 00:00 BST==2026-06-23 23:00 UTC). The handler then builds its directory fromutcnow()(2026-06-23) while the assertion expects2026-06-24, producing:This is a latent test bug that surfaces for any contributor in a positive-offset timezone.
The fix makes the
time_machine.traveltargets explicit UTC instants (f"{date} 00:00:00+00:00") so the day no longer shifts with the host timezone. Behaviour under test is unchanged; only the test's time control is made timezone-independent.Was generative AI tooling used to co-author this PR?
Generated-by: GitHub Copilot (Claude Opus 4.8) following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.