Add Django 6.0 support (#9819)

* 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":"অভি"} <auvipy@gmail.com>
Co-authored-by: Bruno Alla <alla.brunoo@gmail.com>
This commit is contained in:
Mehraz Hossain Rumman 2025-12-05 16:30:00 +06:00 committed by GitHub
parent 7eed4ab34d
commit 0fbaebc3dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 7 deletions

View File

@ -15,6 +15,7 @@ def pytest_configure(config):
settings.configure( settings.configure(
DEBUG_PROPAGATE_EXCEPTIONS=True, DEBUG_PROPAGATE_EXCEPTIONS=True,
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
DATABASES={ DATABASES={
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.sqlite3',

View File

@ -1,7 +1,7 @@
import unittest import unittest
from django.template import Context, Template 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 django.utils.html import urlize
from rest_framework.compat import coreapi, coreschema from rest_framework.compat import coreapi, coreschema
@ -240,6 +240,7 @@ class Issue1386Tests(TestCase):
Covers #1386 Covers #1386
""" """
@override_settings(URLIZE_ASSUME_HTTPS=True)
def test_issue_1386(self): def test_issue_1386(self):
""" """
Test function urlize with different args Test function urlize with different args

View File

@ -752,7 +752,7 @@ class TestUniqueConstraintValidation(TestCase):
validators = serializer.fields['fancy_conditions'].validators validators = serializer.fields['fancy_conditions'].validators
assert len(validators) == 2 + extra_validators_qty 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])} assert ids_in_qs == {frozenset([1]), frozenset([3])}
def test_nullable_unique_constraint_fields_are_not_required(self): def test_nullable_unique_constraint_fields_are_not_required(self):

11
tox.ini
View File

@ -2,9 +2,9 @@
envlist = envlist =
{py310}-{django42,django51,django52} {py310}-{django42,django51,django52}
{py311}-{django42,django51,django52} {py311}-{django42,django51,django52}
{py312}-{django42,django51,django52,djangomain} {py312}-{django42,django51,django52,django60,djangomain}
{py313}-{django51,django52,djangomain} {py313}-{django51,django52,django60,djangomain}
{py314}-{django52,djangomain} {py314}-{django52,django60,djangomain}
base base
dist dist
docs docs
@ -20,6 +20,7 @@ deps =
django50: Django>=5.0,<5.1 django50: Django>=5.0,<5.1
django51: Django>=5.1,<5.2 django51: Django>=5.1,<5.2
django52: Django>=5.2,<6.0 django52: Django>=5.2,<6.0
django60: Django>=6.0,<6.1
djangomain: https://github.com/django/django/archive/main.tar.gz djangomain: https://github.com/django/django/archive/main.tar.gz
-rrequirements/requirements-testing.txt -rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt -rrequirements/requirements-optionals.txt
@ -27,13 +28,13 @@ deps =
[testenv:base] [testenv:base]
; Ensure optional dependencies are not required ; Ensure optional dependencies are not required
deps = deps =
django<6.0 django<6.1
-rrequirements/requirements-testing.txt -rrequirements/requirements-testing.txt
[testenv:dist] [testenv:dist]
commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs} commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs}
deps = deps =
django<6.0 django<6.1
-rrequirements/requirements-testing.txt -rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt -rrequirements/requirements-optionals.txt