From 9d1b62d45771d7c66c106babe9c1c1b4d6e034d3 Mon Sep 17 00:00:00 2001 From: Stu Tomlinson Date: Thu, 3 Apr 2025 14:33:12 +0100 Subject: [PATCH 1/2] test updates update tests to include Python 3.13 and use by default; and drop Python 3.7 (no longer supported, incompatible with latest pytest) require pytest-django 4.11.1 to address DB access issues in 4.11.0 ensure same version of pytest & pytest-django used for local tests and CI --- .github/workflows/ci.yml | 10 +++++----- requirements-test.txt | 4 ++-- setup.py | 1 - tox.ini | 10 +++++----- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e6ae5af..0c1040a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - name: Set up Python 3.10 + - name: Set up Python 3.13 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.13" - name: "Install Dependencies" run: pip install flake8 - name: Lint @@ -26,10 +26,10 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10"] experimental: [false] include: - - python-version: "3.11" + - python-version: "3.13" experimental: true services: @@ -67,6 +67,6 @@ jobs: run: pip install tox tox-gh-actions - name: "Run tests" - run: tox ${{ matrix.experimental && '-e py311-djmain' || '' }} + run: tox ${{ matrix.experimental && '-e py313-djmain' || '' }} env: MYSQL_HOST: 127.0.0.1 diff --git a/requirements-test.txt b/requirements-test.txt index 26aba6c7..b29d05a6 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,5 +1,5 @@ -pytest==8.3.3 -pytest-django==4.5.2 +pytest==8.3.5 +pytest-django==4.11.1 django>=3.2 redis>=3.0.0 funcy>=1.8 diff --git a/setup.py b/setup.py index 9615f1a0..02375d24 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,6 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', diff --git a/tox.ini b/tox.ini index 471d1932..60a5df56 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,21 @@ [tox] envlist = lint, - py37-dj32, py{38,39}-dj{32,40}, py310-dj{32,40,41}, py311-dj{41,42,50}, py312-dj{42,50}, + py313-dj{42,50}, pypy310-dj40 [gh-actions] python = - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 3.11: py311 3.12: py312 + 3.13: py313 pypy-3.10: pypy310 @@ -27,8 +27,8 @@ setenv = CPLUS_INCLUDE_PATH=/usr/include/gdal C_INCLUDE_PATH=/usr/include/gdal deps = - pytest - pytest-django + pytest==8.3.5 + pytest-django==4.11.1 dj32: Django>=3.2,<3.3 dj40: Django>=4.0,<4.1 dj41: Django>=4.1,<4.2 @@ -36,7 +36,7 @@ deps = dj50: Django>=5.0,<5.1 djmain: git+https://github.com/django/django mysqlclient - py{37,38,39,310,311,312}: psycopg2-binary + py{38,39,310,311,312,313}: psycopg2-binary ; gdal=={env:GDAL_VERSION:2.4} pypy310: psycopg2cffi>=2.7.6 before_after==1.0.0 From 35f56a47e47ff21e246eac9f58e8744f9f0576ad Mon Sep 17 00:00:00 2001 From: Stu Tomlinson Date: Wed, 2 Apr 2025 16:06:16 +0100 Subject: [PATCH 2/2] django 5.2 compatibility Closes #494 --- cacheops/tree.py | 9 ++++++++- setup.py | 1 + tox.ini | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/cacheops/tree.py b/cacheops/tree.py index cebf9376..6334ac73 100644 --- a/cacheops/tree.py +++ b/cacheops/tree.py @@ -6,13 +6,20 @@ from django.db.models.sql import OR from django.db.models.sql.datastructures import Join from django.db.models.sql.query import Query, ExtraWhere -from django.db.models.sql.where import NothingNode, SubqueryConstraint +from django.db.models.sql.where import NothingNode from django.db.models.lookups import Lookup, Exact, In, IsNull from django.db.models.expressions import BaseExpression, Exists from .conf import settings from .invalidation import serializable_fields +# This existed prior to Django 5.2 +try: + from django.db.models.sql.where import SubqueryConstraint +except ImportError: + class SubqueryConstraint(object): + pass + def dnfs(qs): """ diff --git a/setup.py b/setup.py index 02375d24..7f4badc2 100644 --- a/setup.py +++ b/setup.py @@ -44,6 +44,7 @@ 'Framework :: Django :: 4.1', 'Framework :: Django :: 4.2', 'Framework :: Django :: 5.0', + 'Framework :: Django :: 5.2', 'Environment :: Web Environment', 'Intended Audience :: Developers', diff --git a/tox.ini b/tox.ini index 60a5df56..7bfb0c78 100644 --- a/tox.ini +++ b/tox.ini @@ -4,8 +4,8 @@ envlist = py{38,39}-dj{32,40}, py310-dj{32,40,41}, py311-dj{41,42,50}, - py312-dj{42,50}, - py313-dj{42,50}, + py312-dj{42,50,52}, + py313-dj{42,50,52}, pypy310-dj40 [gh-actions] @@ -34,6 +34,7 @@ deps = dj41: Django>=4.1,<4.2 dj42: Django>=4.2.8,<5.0 dj50: Django>=5.0,<5.1 + dj52: Django>=5.2,<5.3 djmain: git+https://github.com/django/django mysqlclient py{38,39,310,311,312,313}: psycopg2-binary