Skip to content

Commit

Permalink
Merge pull request #88 from brutasse/django4-tests
Browse files Browse the repository at this point in the history
Fixes tox.ini file to successfully run tests
  • Loading branch information
vrocha authored Nov 24, 2023
2 parents 218f51d + cf5e9b2 commit 223705f
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 56 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
django_password_reset.egg-info
dist
docs/_build
.idea
*.pyc
.tox
build
password_reset.egg-info
.pytest_cache
45 changes: 22 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
language: python
python: "3.6"
sudo: false
cache: pip
env:
- TOXENV=py27-django111
- TOXENV=py34-django111
- TOXENV=py35-django111
- TOXENV=py36-django111
- TOXENV=py34-django20
- TOXENV=py35-django20
- TOXENV=py36-django20
- TOXENV=py35-django21
- TOXENV=py36-django21
- TOXENV=py38-django30
- TOXENV=py39-django30
- TOXENV=py310-django30
- TOXENV=py38-django40
- TOXENV=py39-django40
- TOXENV=py310-django40
- TOXENV=docs
- TOXENV=lint
matrix:
include:
- python: "3.5"
env: TOXENV=py35-django111
- python: "3.5"
env: TOXENV=py35-django20
- python: "3.5"
env: TOXENV=py35-django21
exclude:
- python: "3.6"
env: TOXENV=py35-django111
- python: "3.6"
env: TOXENV=py35-django20
- python: "3.6"
env: TOXENV=py35-django21
- python: "3.8"
env: TOXENV=py38-django30
- python: "3.9"
env: TOXENV=py39-django30
- python: "3.10"
env: TOXENV=py310-django30
- python: "3.8"
env: TOXENV=py38-django40
- python: "3.9"
env: TOXENV=py39-django40
- python: "3.10"
env: TOXENV=py310-django40
- python: "3.9"
env: TOXENV=docs
- python: "3.9"
env: TOXENV=lint
install:
- pip install tox
script:
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ functionality.

* Author: Bruno Renié and `contributors`_
* Licence: BSD
* Compatibility: Django 1.11+

* Compatibility: Django 3+
* Python 3+
.. _contributors: https://github.com/brutasse/django-password-reset/contributors

Installation
Expand Down
3 changes: 3 additions & 0 deletions password_reset/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@
),
},
}]

USE_TZ = True
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.test.utils import override_settings
from django.urls import reverse
from django.utils import timezone
from django.utils.six import with_metaclass

from ..forms import PasswordRecoveryForm, PasswordResetForm
from .models import CustomUser, ExtensionUser
Expand Down Expand Up @@ -38,7 +37,7 @@ def create_user():
return get_user_model()._default_manager.create_user(*args, **kwargs)


class FormTests(with_metaclass(CustomUserVariants, TestCase)):
class FormTests(TestCase, metaclass=CustomUserVariants):
def test_username_input(self):
User = get_user_model()
if User is CustomUser:
Expand Down Expand Up @@ -199,7 +198,7 @@ def test_form_commit(self):
user.password)


class ViewTests(with_metaclass(CustomUserVariants, TestCase)):
class ViewTests(TestCase, metaclass=CustomUserVariants):
def test_recover(self):
self.user = create_user()
url = reverse('password_reset_recover')
Expand Down
12 changes: 6 additions & 6 deletions password_reset/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.conf.urls import url
from django.urls import path

from ..urls import urlpatterns
from . import views

urlpatterns += [
url(r'^email_recover/$', views.email_recover, name='email_recover'),
url(r'^username_recover/$', views.username_recover,
name='username_recover'),
url(r'^insensitive_recover/$', views.insensitive_recover,
name='insensitive_recover'),
path('email_recover/', views.email_recover, name='email_recover'),
path('username_recover/', views.username_recover,
name='username_recover'),
path('insensitive_recover/', views.insensitive_recover,
name='insensitive_recover'),
]
4 changes: 2 additions & 2 deletions password_reset/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

urlpatterns = [
path('recover/<str:signature>/', views.recover_done,
name='password_reset_sent'),
name='password_reset_sent'),
path('recover/', views.recover, name='password_reset_recover'),
path('reset/done/', views.reset_done, name='password_reset_done'),
path('reset/<str:token>/', views.reset,
name='password_reset_reset'),
name='password_reset_reset'),
]
37 changes: 17 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
[tox]
envlist =
py27-django111,
py34-django{111,20},
py35-django{111,20,21},
py36-django{111,20,21},
qenvlist =
py38-django{30,40},
py39-django{30,40},
py310-django{30,40},
docs, lint

[testenv]
commands = python -Wall setup.py test
commands = python -Wall setup.py test # or your test command
basepython =
py27: python2.7
py34: python3.4
py35: python3.5
py36: python3.6
py38: python3.8
py39: python3.9
py310: python3.10
deps =
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django30: Django>=3.0,<4.0
django40: Django>=4.0,<5.0

[testenv:docs]
basepython = python3.6
basepython = python3.9
changedir = docs
deps =
Sphinx
sphinx_rtd_theme
Sphinx
sphinx_rtd_theme
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

[testenv:lint]
basepython = python3.6
basepython = python3.9
deps =
flake8
flake8
commands =
flake8 {toxinidir}/password_reset
flake8 {toxinidir}/password_reset

0 comments on commit 223705f

Please # to comment.