Fix graphite.util.epoch for Django 5#2914
Open
samestep wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 tasks
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2914 +/- ##
==========================================
+ Coverage 76.80% 76.90% +0.09%
==========================================
Files 88 88
Lines 9700 9703 +3
Branches 1805 1806 +1
==========================================
+ Hits 7450 7462 +12
+ Misses 1983 1971 -12
- Partials 267 270 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This PR fixes the
test_epoch_naivefailure that currently occurs when running the Graphite test suite with Django 5; as a specific reproducible example, here's the relevantnix-build -A python3Packages.graphite-weblog snippet at NixOS/nixpkgs@4060765:#2886 added support for Django 5, but this repo's CI didn't catch the test failure because the tox configuration forces Django 4:
graphite-web/.github/workflows/tests.yml
Lines 72 to 83 in b5d272b
graphite-web/tox.ini
Line 37 in b5d272b
The reason the test fails is because of a change in Django 5:
Specifically, django/django@e6f8243 removed the pytz-specific branch from
django.utils.timezone.make_aware.The fix is to replace this
make_awarecall with code equivalent to what the Django 4 implementation ofmake_awarewould have done. Note that the effect ofis_dst=Noneis toraisein some specific cases; otherwise thelocalizemethod defaults tois_dst=False, which would silently use standard time in those cases.The other
make_awarecall (in theepoch_to_dtfunction) does not need to change because the UTC timezone is unaffected by this Django behavior change.