Skip to content

Commit 656d835

Browse files
committed
Fix test with Django 5 when pytz is available
1 parent 33d59fe commit 656d835

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_fields.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
except ImportError:
1717
pytz = None
1818

19+
import django
1920
from django.core.exceptions import ValidationError as DjangoValidationError
2021
from django.db.models import IntegerChoices, TextChoices
2122
from django.http import QueryDict
@@ -1624,7 +1625,8 @@ def test_should_render_date_time_in_default_timezone(self):
16241625
assert rendered_date == rendered_date_in_timezone
16251626

16261627

1627-
@pytest.mark.skipif(pytz is None, reason="Django 5.0 has removed pytz; this test should eventually be able to get removed.")
1628+
@pytest.mark.skipif(pytz is None or django.VERSION >= (5,),
1629+
reason="Django 5.0 has removed pytz; this test should eventually be able to get removed.")
16281630
class TestPytzNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues):
16291631
"""
16301632
Invalid values for `DateTimeField` with datetime in DST shift (non-existing or ambiguous) and timezone with DST.

0 commit comments

Comments
 (0)