Skip to content

Commit

Permalink
🤝 Use packaging.version where available (#210)
Browse files Browse the repository at this point in the history
* Use packaging.version where available

* Test on 3.12
  • Loading branch information
offbyone authored May 3, 2024
1 parent e24a8e7 commit 93ab347
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
django-version:
- "2.2" # LTS
- "3.2" # LTS
Expand All @@ -48,6 +49,11 @@ jobs:
django-version: "2.2"
- python-version: "3.11"
django-version: "3.2"
# Python 3.12 is compatible with Django 4.0+
- python-version: "3.12"
django-version: "2.2"
- python-version: "3.12"
django-version: "3.2"
# Django 4.0 is compatible with Python 3.8+
- python-version: "3.6"
django-version: "4.0"
Expand Down
3 changes: 2 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

DJANGO_VERSIONS = ["2.2", "3.2", "4.1", "4.2"]
DRF_VERSIONS = ["3.11", "3.12", "3.13", "3.14"]
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11"]
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]

INVALID_PYTHON_DJANGO_SESSIONS = [
("3.11", "3.2"),
("3.12", "3.2"),
]


Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ classifiers =
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12

[options]
include_package_data = True
Expand Down
7 changes: 5 additions & 2 deletions test_plus/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import django

from distutils.version import LooseVersion
try:
from packaging.version import parse as parse_version
except ImportError:
from distutils.version import LooseVersion as parse_version

from django.conf import settings
from django.contrib.auth import get_user_model
Expand Down Expand Up @@ -157,7 +160,7 @@ def head(self, url_name, *args, **kwargs):
return self.request('head', url_name, *args, **kwargs)

def trace(self, url_name, *args, **kwargs):
if LooseVersion(django.get_version()) >= LooseVersion('1.8.2'):
if parse_version(django.get_version()) >= parse_version('1.8.2'):
return self.request('trace', url_name, *args, **kwargs)
else:
raise LookupError("client.trace is not available for your version of django. Please\
Expand Down

0 comments on commit 93ab347

Please sign in to comment.