From 0fbaebc3ddeb1ee27a6d34a98d40eb90e034c680 Mon Sep 17 00:00:00 2001 From: Mehraz Hossain Rumman <59512321+MehrazRumman@users.noreply.github.com> Date: Fri, 5 Dec 2025 16:30:00 +0600 Subject: [PATCH] Add Django 6.0 support (#9819) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * adding django6.0a support * test fixed * gitignore updated * pre-commit applied * test issue 1386 fixed * fixing test issue 1386 * .gov domain handled for different version * correct urls updated * Modify URL test cases for Django version compatibility Adjust URL test cases based on Django version. * Add Django import to test_templatetags.py * Reorder import statements in test file * Update tox.ini * Update tox.ini * Revert unnecessary changes in tests * Default to AutoField for now * Add Django upper bound to base and dist tests to avoid testing on unsupported versions --------- Co-authored-by: Asif Saif Uddin {"Auvi":"অভি"} Co-authored-by: Bruno Alla --- tests/conftest.py | 1 + tests/test_templatetags.py | 3 ++- tests/test_validators.py | 2 +- tox.ini | 11 ++++++----- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 01914ae77..11a079f48 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,6 +15,7 @@ def pytest_configure(config): settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, + DEFAULT_AUTO_FIELD="django.db.models.AutoField", DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index 7134c1bae..8260fc839 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -1,7 +1,7 @@ import unittest from django.template import Context, Template -from django.test import TestCase +from django.test import TestCase, override_settings from django.utils.html import urlize from rest_framework.compat import coreapi, coreschema @@ -240,6 +240,7 @@ class Issue1386Tests(TestCase): Covers #1386 """ + @override_settings(URLIZE_ASSUME_HTTPS=True) def test_issue_1386(self): """ Test function urlize with different args diff --git a/tests/test_validators.py b/tests/test_validators.py index 79d4c0cf8..96354b9b1 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -752,7 +752,7 @@ class TestUniqueConstraintValidation(TestCase): validators = serializer.fields['fancy_conditions'].validators assert len(validators) == 2 + extra_validators_qty - ids_in_qs = {frozenset(v.queryset.values_list(flat=True)) for v in validators if hasattr(v, "queryset")} + ids_in_qs = {frozenset(v.queryset.values_list('id', flat=True)) for v in validators if hasattr(v, "queryset")} assert ids_in_qs == {frozenset([1]), frozenset([3])} def test_nullable_unique_constraint_fields_are_not_required(self): diff --git a/tox.ini b/tox.ini index b27c13d0f..6980d0bfa 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,9 @@ envlist = {py310}-{django42,django51,django52} {py311}-{django42,django51,django52} - {py312}-{django42,django51,django52,djangomain} - {py313}-{django51,django52,djangomain} - {py314}-{django52,djangomain} + {py312}-{django42,django51,django52,django60,djangomain} + {py313}-{django51,django52,django60,djangomain} + {py314}-{django52,django60,djangomain} base dist docs @@ -20,6 +20,7 @@ deps = django50: Django>=5.0,<5.1 django51: Django>=5.1,<5.2 django52: Django>=5.2,<6.0 + django60: Django>=6.0,<6.1 djangomain: https://github.com/django/django/archive/main.tar.gz -rrequirements/requirements-testing.txt -rrequirements/requirements-optionals.txt @@ -27,13 +28,13 @@ deps = [testenv:base] ; Ensure optional dependencies are not required deps = - django<6.0 + django<6.1 -rrequirements/requirements-testing.txt [testenv:dist] commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs} deps = - django<6.0 + django<6.1 -rrequirements/requirements-testing.txt -rrequirements/requirements-optionals.txt