diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8009b8a..01af650 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,62 +9,78 @@ jobs: matrix: include: # Django 2.2 - - django-version: "2.2.0" - python-version: "3.5" - - django-version: "2.2.0" - python-version: "3.6" - - django-version: "2.2.0" + - django-version: "2.2" python-version: "3.7" - - django-version: "2.2.0" + - django-version: "2.2" python-version: "3.8" - - django-version: "2.2.0" + - django-version: "2.2" python-version: "3.9" # Django 3.0 - - django-version: "3.0.0" - python-version: "3.6" - - django-version: "3.0.0" + - django-version: "3.0" python-version: "3.7" - - django-version: "3.0.0" + - django-version: "3.0" python-version: "3.8" - - django-version: "3.0.0" + - django-version: "3.0" python-version: "3.9" # Django 3.1 - - django-version: "3.1.0" - python-version: "3.6" - - django-version: "3.1.0" + - django-version: "3.1" python-version: "3.7" - - django-version: "3.1.0" + - django-version: "3.1" python-version: "3.8" - - django-version: "3.1.0" + - django-version: "3.1" python-version: "3.9" # Django 3.2 - - django-version: "3.2.0" - python-version: "3.6" - - django-version: "3.2.0" + - django-version: "3.2" python-version: "3.7" - - django-version: "3.2.0" + - django-version: "3.2" python-version: "3.8" - - django-version: "3.2.0" + - django-version: "3.2" python-version: "3.9" - - django-version: "3.2.0" + - django-version: "3.2" python-version: "3.10" # Django 4.0 - - django-version: "4.0.0" + - django-version: "4.0" python-version: "3.8" - - django-version: "4.0.0" + - django-version: "4.0" python-version: "3.9" - - django-version: "4.0.0" + - django-version: "4.0" python-version: "3.10" + # Django 4.1 + - django-version: "4.1" + python-version: "3.8" + - django-version: "4.1" + python-version: "3.9" + - django-version: "4.1" + python-version: "3.10" + + # Django 4.2 + - django-version: "4.2" + python-version: "3.8" + - django-version: "4.2" + python-version: "3.9" + - django-version: "4.2" + python-version: "3.10" + - django-version: "4.2" + python-version: "3.11" + + # Django 5.0 + - django-version: "5.0" + python-version: "3.10" + - django-version: "5.0" + python-version: "3.11" + - django-version: "5.0" + python-version: "3.12" + steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/CHANGES.rst b/CHANGES.rst index eece077..c2201d5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,11 @@ CHANGES 2.0.1 (unreleased) ------------------ -- Nothing changed yet. +- Resolve `SHA1PasswordHasher` deprecation warning for Django 4.0 and above +- Resolve `pkg_resources` deprecation warning for Python 3.8 and above +- Add test coverage for Django 4.1, 4.2, and 5.0 +- Add test coverage for Python 3.11 and 3.12 +- Python 3.5 and 3.6 are no longer availble in GitHub runner using `ubuntu-latest` 2.0.0 (2022-07-29) diff --git a/authtools/__init__.py b/authtools/__init__.py index f7da2c3..ca89bb9 100644 --- a/authtools/__init__.py +++ b/authtools/__init__.py @@ -1,3 +1,8 @@ -import pkg_resources +try: + from importlib.metadata import version -__version__ = pkg_resources.get_distribution('django-authtools').version + __version__ = version('django-authtools') +except ImportError: + import pkg_resources + + __version__ = pkg_resources.get_distribution('django-authtools').version diff --git a/docs/index.rst b/docs/index.rst index a022293..fb2f638 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ django-authtools ================ -A custom user model app for Django 1.5+. It tries to stay true to the built-in +A custom user model app for Django 2.2+. It tries to stay true to the built-in User model for the most part. The main differences between authtools and django.contrib.auth are a User model with email as username. diff --git a/tests/tests/settings.py b/tests/tests/settings.py index be81fc3..7abbee2 100644 --- a/tests/tests/settings.py +++ b/tests/tests/settings.py @@ -58,13 +58,8 @@ }, ] -# sha1 hasher was removed as a default in django 1.10. Need it for the tests. PASSWORD_HASHERS = [ - 'django.contrib.auth.hashers.SHA1PasswordHasher', 'django.contrib.auth.hashers.PBKDF2PasswordHasher', - 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', - 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher', - 'django.contrib.auth.hashers.BCryptPasswordHasher', ] USE_TZ = False diff --git a/tests/tests/tests.py b/tests/tests/tests.py index 343d31f..687f972 100644 --- a/tests/tests/tests.py +++ b/tests/tests/tests.py @@ -154,12 +154,12 @@ def test_uses_auth_password_validators(self): @skipIfCustomUser -@override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) +@override_settings(USE_TZ=False) class UserChangeFormTest(TestCase): @classmethod def setUpTestData(cls): cls.u1 = User.objects.create( - password='sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161', + password='pbkdf2_sha256$600000$U3$rhq9d758wGq/JU5/+bkG8OqDVY05d04zKD4cuamR+Sk=', last_login=datetime.datetime(2006, 12, 17, 7, 3, 31), is_superuser=False, username='testclient', first_name='Test', last_name='Client', email='testclient@example.com', is_staff=False, is_active=True, date_joined=datetime.datetime(2006, 12, 17, 7, 3, 31) @@ -242,7 +242,7 @@ def test_bug_19133(self): form = UserChangeForm(instance=user, data=post_data) self.assertTrue(form.is_valid()) - self.assertEqual(form.cleaned_data['password'], 'sha1$6efc0$f93efe9fd7542f25a7be94871ea45aa95de57161') + self.assertEqual(form.cleaned_data['password'], 'pbkdf2_sha256$600000$U3$rhq9d758wGq/JU5/+bkG8OqDVY05d04zKD4cuamR+Sk=') def test_bug_19349_bound_password_field(self): user = User.objects.get(username='testclient') diff --git a/tox.ini b/tox.ini index fcaac30..2972bac 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,17 @@ [tox] envlist= - py39-dj{22,30,31,32,40} + py37-dj{22,30,32,32} + py{38,39}-dj{22,30,31,32,40,41,42} + py{10}-dj{32,40,41,42,50} + py{11,12}-dj{42,50} [testenv] python= + py37: python3.7 + py38: python3.8 py39: python3.9 + py310: python3.10 + py311: python3.11 + py312: python3.12 commands= /usr/bin/env make test @@ -13,6 +21,9 @@ deps= dj31: Django>=3.1,<3.2 dj32: Django>=3.2,<3.3 dj40: Django>=4.0,<4.1 + dj41: Django>=4.1,<4.2 + dj42: Django>=4.2,<4.3 + dj50: Django>=5.0,<5.1 whitelist_externals= env make