Skip to content

update for Django 6.0 #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- run: python -m pip install flake8
- name: flake8
uses: liskin/gh-problem-matcher-wrap@v2
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- run: python -m pip install isort
- name: isort
uses: liskin/gh-problem-matcher-wrap@v2
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ jobs:
fail-fast: false
matrix:
include:
- crdb-version: v23.2.21
- crdb-version: v23.2.21
use_psycopg2: psycopg2
- crdb-version: v23.2.21
use_server_side_binding: server_side_binding
- crdb-version: v24.1.14
- crdb-version: v24.1.14
use_psycopg2: psycopg2
Expand Down Expand Up @@ -64,7 +59,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- name: Install system packages for Django's Python test dependencies
run: |
sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion django-test-suite/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ VERSION=$1

# clone django into the repo.
rm -rf _django_repo
git clone --depth 1 --single-branch --branch cockroach-5.2.x https://github.com/timgraham/django _django_repo
git clone --depth 1 --single-branch --branch cockroach-6.0.x https://github.com/timgraham/django _django_repo

# install the django requirements.
cd _django_repo/tests/
Expand Down
2 changes: 1 addition & 1 deletion django_cockroachdb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '5.2'
__version__ = '6.0a0'

# Check Django compatibility before other imports which may fail if the
# wrong version of Django is installed.
Expand Down
25 changes: 10 additions & 15 deletions django_cockroachdb/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class DatabaseFeatures(PostgresDatabaseFeatures):
minimum_database_version = (23, 2)
minimum_database_version = (24, 1)

# Cloning databases doesn't speed up tests.
# https://github.com/cockroachdb/django-cockroachdb/issues/206
Expand Down Expand Up @@ -75,10 +75,6 @@ def introspected_field_types(self):
'virtual': None,
}

@cached_property
def is_cockroachdb_24_1(self):
return self.connection.cockroachdb_version >= (24, 1)

@cached_property
def is_cockroachdb_24_3(self):
return self.connection.cockroachdb_version >= (24, 3)
Expand Down Expand Up @@ -169,7 +165,6 @@ def django_test_expected_failures(self):
'bulk_create.tests.BulkCreateTests.test_bulk_insert_nullable_fields',
'many_to_one.tests.ManyToOneTests.test_add_remove_set_by_pk_raises',
'many_to_one.tests.ManyToOneTests.test_fk_to_smallautofield',
'many_to_one.tests.ManyToOneTests.test_get_prefetch_queryset_reverse_warning',
'many_to_one.tests.ManyToOneTests.test_get_prefetch_querysets_reverse_invalid_querysets_length',
'migrations.test_operations.OperationTests.test_smallfield_autofield_foreignfield_growth',
'migrations.test_operations.OperationTests.test_smallfield_bigautofield_foreignfield_growth',
Expand All @@ -185,6 +180,10 @@ def django_test_expected_failures(self):
# new primary key in same transaction
'schema.tests.SchemaTests.test_add_auto_field',
'schema.tests.SchemaTests.test_autofield_to_o2o',
# USING cast required: https://github.com/cockroachdb/cockroach/issues/82416#issuecomment-2029803229
'schema.tests.SchemaTests.test_alter_text_field_to_date_field',
'schema.tests.SchemaTests.test_alter_text_field_to_datetime_field',
'schema.tests.SchemaTests.test_alter_text_field_to_time_field',
# incompatible COALESCE expressions: unsupported binary operator:
# <int> * <int> (desired <decimal>):
# https://github.com/cockroachdb/cockroach/issues/73587
Expand All @@ -205,13 +204,8 @@ def django_test_expected_failures(self):
'migrations.test_operations.OperationTests.test_add_generated_field',
# concat(): unknown signature: concat(string, int2) (desired <string>)
'db_functions.text.test_concat.ConcatTests.test_concat_non_str',
})
if self.is_cockroachdb_24_1:
# USING cast required: https://github.com/cockroachdb/cockroach/issues/82416#issuecomment-2029803229
expected_failures.update({
'schema.tests.SchemaTests.test_alter_text_field_to_date_field',
'schema.tests.SchemaTests.test_alter_text_field_to_datetime_field',
'schema.tests.SchemaTests.test_alter_text_field_to_time_field',
# unknown signature: concat(timestamptz, string)
"aggregation.tests.AggregateTestCase.test_string_agg_order_by",
})
if self.is_cockroachdb_25_1:
expected_failures.update({
Expand All @@ -238,9 +232,7 @@ def django_test_expected_failures(self):
'expressions_case.tests.CaseExpressionTests.test_annotate_with_aggregation_in_predicate',
'expressions_case.tests.CaseExpressionTests.test_annotate_with_annotation_in_condition',
'expressions_case.tests.CaseExpressionTests.test_annotate_with_annotation_in_predicate',
'expressions_case.tests.CaseExpressionTests.test_annotate_with_empty_when',
'expressions_case.tests.CaseExpressionTests.test_annotate_with_expression_as_condition',
'expressions_case.tests.CaseExpressionTests.test_annotate_with_full_when',
'expressions_case.tests.CaseExpressionTests.test_annotate_with_join_in_condition',
'expressions_case.tests.CaseExpressionTests.test_annotate_with_join_in_predicate',
'expressions_case.tests.CaseExpressionTests.test_case_reuse',
Expand All @@ -251,6 +243,7 @@ def django_test_expected_failures(self):
'lookup.tests.LookupQueryingTests.test_conditional_expression',
'ordering.tests.OrderingTests.test_order_by_constant_value',
'queries.test_bulk_update.BulkUpdateNoteTests.test_batch_size',
'queries.test_bulk_update.BulkUpdateNoteTests.test_max_batch_size',
'queries.test_bulk_update.BulkUpdateNoteTests.test_multiple_fields',
'queries.test_bulk_update.BulkUpdateNoteTests.test_simple',
'queries.test_bulk_update.BulkUpdateTests.test_custom_pk',
Expand All @@ -275,6 +268,8 @@ def django_test_expected_failures(self):
# incompatible COALESCE expressions: unsupported binary
# operator: <decimal> / <float> (desired <decimal>)
'aggregation.tests.AggregateTestCase.test_aggregation_default_passed_another_aggregate',
# could not parse "@" as type timestamptz: parsing as type timestamp: empty or blank input
"aggregation.tests.AggregateTestCase.test_string_agg_order_by",
})
if self.is_cockroachdb_24_3:
expected_failures.update({
Expand Down
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ classifiers =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
project_urls =
Expand All @@ -28,7 +26,7 @@ project_urls =
python_requires = >=3.10
packages = find:
install_requires =
django >= 5.2, < 6.0
# django >= 6.0, < 6.1

[flake8]
max-line-length = 119
Expand Down