Update 2022.08.07

This commit is contained in:
Alejandro Franco 2022-08-07 19:31:19 -05:00
commit 9749342e29
29 changed files with 231 additions and 87 deletions

View File

@ -1262,5 +1262,25 @@
"name": "Naveen", "name": "Naveen",
"github_login": "naveensrinivasan", "github_login": "naveensrinivasan",
"twitter_username": "snaveen" "twitter_username": "snaveen"
},
{
"name": "Nikita Sobolev",
"github_login": "sobolevn",
"twitter_username": ""
},
{
"name": "Sebastian Reyes Espinosa",
"github_login": "sebastian-code",
"twitter_username": "sebastianreyese"
},
{
"name": "jugglinmike",
"github_login": "jugglinmike",
"twitter_username": ""
},
{
"name": "monosans",
"github_login": "monosans",
"twitter_username": ""
} }
] ]

View File

@ -9,14 +9,14 @@ repos:
- id: check-yaml - id: check-yaml
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.34.0 rev: v2.37.3
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py39-plus] args: [--py39-plus]
exclude: hooks/ exclude: hooks/
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.3.0 rev: 22.6.0
hooks: hooks:
- id: black - id: black
@ -26,7 +26,7 @@ repos:
- id: isort - id: isort
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 4.0.1 rev: 5.0.4
hooks: hooks:
- id: flake8 - id: flake8

View File

@ -3,6 +3,111 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER --> <!-- GENERATOR_PLACEHOLDER -->
## 2022.08.05
### Updated
- Update sentry-sdk to 1.9.2 ([#3832](https://github.com/cookiecutter/cookiecutter-django/pull/3832))
## 2022.08.04
### Updated
- Auto-update pre-commit hooks ([#3816](https://github.com/cookiecutter/cookiecutter-django/pull/3816))
- Update flake8 to 5.0.4 ([#3829](https://github.com/cookiecutter/cookiecutter-django/pull/3829))
- Update django-compressor to 4.1 ([#3823](https://github.com/cookiecutter/cookiecutter-django/pull/3823))
- Update flake8-isort to 4.2.0 ([#3828](https://github.com/cookiecutter/cookiecutter-django/pull/3828))
## 2022.08.03
### Updated
- Update django to 3.2.15 ([#3822](https://github.com/cookiecutter/cookiecutter-django/pull/3822))
## 2022.07.29
### Updated
- Update sentry-sdk to 1.9.0 ([#3815](https://github.com/cookiecutter/cookiecutter-django/pull/3815))
## 2022.07.28
### Updated
- Update werkzeug to 2.2.1 ([#3814](https://github.com/cookiecutter/cookiecutter-django/pull/3814))
## 2022.07.27
### Updated
- Update werkzeug to 2.2.0 ([#3813](https://github.com/cookiecutter/cookiecutter-django/pull/3813))
- Update sphinx to 5.1.1 ([#3811](https://github.com/cookiecutter/cookiecutter-django/pull/3811))
- Update drf-spectacular to 0.23.1 ([#3812](https://github.com/cookiecutter/cookiecutter-django/pull/3812))
## 2022.07.26
### Changed
- Switch from `watchgod` to `watchfiles` ([#3791](https://github.com/cookiecutter/cookiecutter-django/pull/3791))
- Change Django settings file used by pylint ([#3806](https://github.com/cookiecutter/cookiecutter-django/pull/3806))
- Simplify database access in tests ([#3807](https://github.com/cookiecutter/cookiecutter-django/pull/3807))
- Provide more context when wating for PostgreSQL takes too long ([#3782](https://github.com/cookiecutter/cookiecutter-django/pull/3782))
### Updated
- Update django-compressor to 4.0 ([#3802](https://github.com/cookiecutter/cookiecutter-django/pull/3802))
- Update flake8-isort to 4.1.2.post0 ([#3809](https://github.com/cookiecutter/cookiecutter-django/pull/3809))
- Update sphinx to 5.1.0 ([#3808](https://github.com/cookiecutter/cookiecutter-django/pull/3808))
- Update sh to 1.14.3 ([#3798](https://github.com/cookiecutter/cookiecutter-django/pull/3798))
- Auto-update pre-commit hooks ([#3780](https://github.com/cookiecutter/cookiecutter-django/pull/3780))
## 2022.07.22
### Updated
- Update pytest-sugar to 0.9.5 ([#3800](https://github.com/cookiecutter/cookiecutter-django/pull/3800))
- Update sphinx to 5.0.2 ([#3801](https://github.com/cookiecutter/cookiecutter-django/pull/3801))
- Update pillow to 9.2.0 ([#3799](https://github.com/cookiecutter/cookiecutter-django/pull/3799))
- Update werkzeug to 2.1.2 ([#3797](https://github.com/cookiecutter/cookiecutter-django/pull/3797))
## 2022.07.21
### Changed
- Set user to form instance in update user view test ([#3776](https://github.com/cookiecutter/cookiecutter-django/pull/3776))
- Fix warning from django-coverage-plugin in tests ([#3790](https://github.com/cookiecutter/cookiecutter-django/pull/3790))
- Always use `const` instead of `var` in `gulpfile.js` ([#3786](https://github.com/cookiecutter/cookiecutter-django/pull/3786))
### Updated
- Update flower to 1.1.0 ([#3796](https://github.com/cookiecutter/cookiecutter-django/pull/3796))
- Update coverage to 6.4.2 ([#3783](https://github.com/cookiecutter/cookiecutter-django/pull/3783))
- Update mypy to 0.971 ([#3788](https://github.com/cookiecutter/cookiecutter-django/pull/3788))
- Update sentry-sdk to 1.8.0 ([#3792](https://github.com/cookiecutter/cookiecutter-django/pull/3792))
- Update pre-commit to 2.20.0 ([#3779](https://github.com/cookiecutter/cookiecutter-django/pull/3779))
- Update django-extensions to 3.2.0 ([#3774](https://github.com/cookiecutter/cookiecutter-django/pull/3774))
- Update tox to 3.25.1 ([#3767](https://github.com/cookiecutter/cookiecutter-django/pull/3767))
- Update uvicorn to 0.18.2 ([#3762](https://github.com/cookiecutter/cookiecutter-django/pull/3762))
- Update redis to 4.3.4 ([#3763](https://github.com/cookiecutter/cookiecutter-django/pull/3763))
- Update requests to 2.28.1 ([#3766](https://github.com/cookiecutter/cookiecutter-django/pull/3766))
## 2022.07.10
### Changed
- Revert auto-update pre-commit hooks ([#3778](https://github.com/cookiecutter/cookiecutter-django/pull/3778))
### Updated
- Auto-update pre-commit hooks ([#3775](https://github.com/cookiecutter/cookiecutter-django/pull/3775))
## 2022.07.06
### Updated
- Update django to 3.2.14 ([#3768](https://github.com/cookiecutter/cookiecutter-django/pull/3768))
## 2022.06.28
### Updated
- Auto-update pre-commit hooks ([#3765](https://github.com/cookiecutter/cookiecutter-django/pull/3765))
- Update black to 22.6.0 ([#3764](https://github.com/cookiecutter/cookiecutter-django/pull/3764))
## 2022.06.23
### Updated
- Update django-debug-toolbar to 3.5.0 ([#3760](https://github.com/cookiecutter/cookiecutter-django/pull/3760))
## 2022.06.22
### Updated
- Update django-stubs to 1.12.0 ([#3757](https://github.com/cookiecutter/cookiecutter-django/pull/3757))
- Update sentry-sdk to 1.6.0 ([#3756](https://github.com/cookiecutter/cookiecutter-django/pull/3756))
- Update djangorestframework-stubs to 1.7.0 ([#3754](https://github.com/cookiecutter/cookiecutter-django/pull/3754))
## 2022.06.15 ## 2022.06.15
### Updated ### Updated

View File

@ -1006,6 +1006,13 @@ Listed in alphabetical order.
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>jugglinmike</td>
<td>
<a href="https://github.com/jugglinmike">jugglinmike</a>
</td>
<td></td>
</tr>
<tr> <tr>
<td>Jules Cheron</td> <td>Jules Cheron</td>
<td> <td>
@ -1335,6 +1342,13 @@ Listed in alphabetical order.
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>monosans</td>
<td>
<a href="https://github.com/monosans">monosans</a>
</td>
<td></td>
</tr>
<tr> <tr>
<td>mozillazg</td> <td>mozillazg</td>
<td> <td>
@ -1363,6 +1377,13 @@ Listed in alphabetical order.
</td> </td>
<td>moby_dick91</td> <td>moby_dick91</td>
</tr> </tr>
<tr>
<td>Nikita Sobolev</td>
<td>
<a href="https://github.com/sobolevn">sobolevn</a>
</td>
<td></td>
</tr>
<tr> <tr>
<td>Noah H</td> <td>Noah H</td>
<td> <td>
@ -1524,6 +1545,13 @@ Listed in alphabetical order.
</td> </td>
<td>saschalalala</td> <td>saschalalala</td>
</tr> </tr>
<tr>
<td>Sebastian Reyes Espinosa</td>
<td>
<a href="https://github.com/sebastian-code">sebastian-code</a>
</td>
<td>sebastianreyese</td>
</tr>
<tr> <tr>
<td>Simon Rey</td> <td>Simon Rey</td>
<td> <td>

View File

@ -1,2 +1,2 @@
sphinx==5.0.1 sphinx==5.1.1
sphinx-rtd-theme==1.0.0 sphinx-rtd-theme==1.0.0

View File

@ -1,18 +1,18 @@
cookiecutter==2.1.1 cookiecutter==2.1.1
sh==1.14.2 sh==1.14.3; sys_platform != "win32"
binaryornot==0.4.4 binaryornot==0.4.4
# Code quality # Code quality
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
black==22.3.0 black==22.6.0
isort==5.10.1 isort==5.10.1
flake8==4.0.1 flake8==5.0.4
flake8-isort==4.1.1 flake8-isort==4.2.0
pre-commit==2.19.0 pre-commit==2.20.0
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
tox==3.25.0 tox==3.25.1
pytest==7.1.2 pytest==7.1.2
pytest-cookies==0.6.1 pytest-cookies==0.6.1
pytest-instafail==0.4.2 pytest-instafail==0.4.2
@ -23,4 +23,4 @@ pyyaml==6.0
PyGithub==1.55 PyGithub==1.55
gitpython==3.1.27 gitpython==3.1.27
jinja2==3.1.2 jinja2==3.1.2
requests==2.28.0 requests==2.28.1

View File

@ -11,8 +11,9 @@ from __future__ import annotations
import os import os
import re import re
import sys import sys
from collections.abc import Iterable
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, NamedTuple from typing import TYPE_CHECKING, Any, NamedTuple
import requests import requests
from github import Github from github import Github

View File

@ -1,8 +1,8 @@
import datetime as dt import datetime as dt
import os import os
import re import re
from collections.abc import Iterable
from pathlib import Path from pathlib import Path
from typing import Iterable
import git import git
import github.PullRequest import github.PullRequest

View File

@ -5,7 +5,7 @@ except ImportError:
from distutils.core import setup from distutils.core import setup
# We use calendar versioning # We use calendar versioning
version = "2022.06.15" version = "2022.08.05"
with open("README.rst") as readme_file: with open("README.rst") as readme_file:
long_description = readme_file.read() long_description = readme_file.read()

View File

@ -10,13 +10,13 @@ repos:
- id: check-yaml - id: check-yaml
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v2.34.0 rev: v2.37.3
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py39-plus] args: [--py39-plus]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.3.0 rev: 22.6.0
hooks: hooks:
- id: black - id: black
@ -26,7 +26,7 @@ repos:
- id: isort - id: isort
- repo: https://github.com/PyCQA/flake8 - repo: https://github.com/PyCQA/flake8
rev: 4.0.1 rev: 5.0.4
hooks: hooks:
- id: flake8 - id: flake8
args: ["--config=setup.cfg"] args: ["--config=setup.cfg"]

View File

@ -1,6 +1,6 @@
[MASTER] [MASTER]
load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery{% endif %} load-plugins=pylint_django{% if cookiecutter.use_celery == "y" %}, pylint_celery{% endif %}
django-settings-module=config.settings.base django-settings-module=config.settings.local
[FORMAT] [FORMAT]
max-line-length=120 max-line-length=120

View File

@ -4,4 +4,4 @@ set -o errexit
set -o nounset set -o nounset
watchgod celery.__main__.main --args -A config.celery_app worker -l INFO watchfiles celery.__main__.main --args '-A config.celery_app worker -l INFO'

View File

@ -18,30 +18,34 @@ fi
#export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" #export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
# Updated in .envs # Updated in .envs
postgres_ready() {
python << END python << END
import sys import sys
import time
import psycopg2 import psycopg2
try: suggest_unrecoverable_after = 30
psycopg2.connect( start = time.time()
dbname="${POSTGRES_DB}",
user="${POSTGRES_USER}",
password="${POSTGRES_PASSWORD}",
host="${POSTGRES_HOST}",
port="${POSTGRES_PORT}",
)
except psycopg2.OperationalError:
sys.exit(-1)
sys.exit(0)
while True:
try:
psycopg2.connect(
dbname="${POSTGRES_DB}",
user="${POSTGRES_USER}",
password="${POSTGRES_PASSWORD}",
host="${POSTGRES_HOST}",
port="${POSTGRES_PORT}",
)
break
except psycopg2.OperationalError as error:
sys.stderr.write("Waiting for PostgreSQL to become available...\n")
if time.time() - start > suggest_unrecoverable_after:
sys.stderr.write(" This is taking longer than expected. The following exception may be indicative of an unrecoverable error: '{}'\n".format(error))
time.sleep(1)
END END
}
until postgres_ready; do
>&2 echo 'Waiting for PostgreSQL to become available...'
sleep 1
done
>&2 echo 'PostgreSQL is available' >&2 echo 'PostgreSQL is available'
exec "$@" exec "$@"

View File

@ -25,5 +25,9 @@ PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend # https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
# DEBUGING FOR TEMPLATES
# ------------------------------------------------------------------------------
TEMPLATES[0]["OPTIONS"]["debug"] = True # type: ignore # noqa F405
# Your stuff... # Your stuff...
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -42,7 +42,7 @@ function pathsConfig(appName) {
} }
} }
var paths = pathsConfig() const paths = pathsConfig()
//////////////////////////////// ////////////////////////////////
// Tasks // Tasks
@ -50,12 +50,12 @@ var paths = pathsConfig()
// Styles autoprefixing and minification // Styles autoprefixing and minification
function styles() { function styles() {
var processCss = [ const processCss = [
autoprefixer(), // adds vendor prefixes autoprefixer(), // adds vendor prefixes
pixrem(), // add fallbacks for rem units pixrem(), // add fallbacks for rem units
] ]
var minifyCss = [ const minifyCss = [
cssnano({ preset: 'default' }) // minify result cssnano({ preset: 'default' }) // minify result
] ]
@ -104,7 +104,7 @@ function imgCompression() {
{%- if cookiecutter.use_async == 'y' -%} {%- if cookiecutter.use_async == 'y' -%}
// Run django server // Run django server
function asyncRunServer() { function asyncRunServer() {
var cmd = spawn('gunicorn', [ const cmd = spawn('gunicorn', [
'config.asgi', '-k', 'uvicorn.workers.UvicornWorker', '--reload' 'config.asgi', '-k', 'uvicorn.workers.UvicornWorker', '--reload'
], {stdio: 'inherit'} ], {stdio: 'inherit'}
) )
@ -115,7 +115,7 @@ function asyncRunServer() {
{%- else %} {%- else %}
// Run django server // Run django server
function runServer(cb) { function runServer(cb) {
var cmd = spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'}) const cmd = spawn('python', ['manage.py', 'runserver'], {stdio: 'inherit'})
cmd.on('close', function(code) { cmd.on('close', function(code) {
console.log('runServer exited with code ' + code) console.log('runServer exited with code ' + code)
cb(code) cb(code)

View File

@ -1,6 +1,6 @@
import os import os
from collections.abc import Sequence
from pathlib import Path from pathlib import Path
from typing import Sequence
import pytest import pytest

View File

@ -1,6 +1,6 @@
pytz==2022.1 # https://github.com/stub42/pytz pytz==2022.1 # https://github.com/stub42/pytz
python-slugify==6.1.2 # https://github.com/un33k/python-slugify python-slugify==6.1.2 # https://github.com/un33k/python-slugify
Pillow==9.1.1 # https://github.com/python-pillow/Pillow Pillow==9.2.0 # https://github.com/python-pillow/Pillow
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
{%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} {%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %}
rcssmin==1.1.0 --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin rcssmin==1.1.0 --install-option="--without-c-extensions" # https://github.com/ndparker/rcssmin
@ -12,7 +12,7 @@ argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi
{%- if cookiecutter.use_whitenoise == 'y' %} {%- if cookiecutter.use_whitenoise == 'y' %}
whitenoise==6.2.0 # https://github.com/evansd/whitenoise whitenoise==6.2.0 # https://github.com/evansd/whitenoise
{%- endif %} {%- endif %}
redis==4.3.3 # https://github.com/redis/redis-py redis==4.3.4 # https://github.com/redis/redis-py
{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %}
hiredis==2.0.0 # https://github.com/redis/hiredis-py hiredis==2.0.0 # https://github.com/redis/hiredis-py
{%- endif %} {%- endif %}
@ -20,23 +20,23 @@ hiredis==2.0.0 # https://github.com/redis/hiredis-py
celery==5.2.7 # pyup: < 6.0 # https://github.com/celery/celery celery==5.2.7 # pyup: < 6.0 # https://github.com/celery/celery
django-celery-beat==2.3.0 # https://github.com/celery/django-celery-beat django-celery-beat==2.3.0 # https://github.com/celery/django-celery-beat
{%- if cookiecutter.use_docker == 'y' %} {%- if cookiecutter.use_docker == 'y' %}
flower==1.0.0 # https://github.com/mher/flower flower==1.1.0 # https://github.com/mher/flower
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- if cookiecutter.use_async == 'y' %} {%- if cookiecutter.use_async == 'y' %}
uvicorn[standard]==0.17.6 # https://github.com/encode/uvicorn uvicorn[standard]==0.18.2 # https://github.com/encode/uvicorn
{%- endif %} {%- endif %}
# Django # Django
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
django==3.2.13 # pyup: < 4.0 # https://www.djangoproject.com/ django==3.2.15 # pyup: < 4.0 # https://www.djangoproject.com/
django-environ==0.9.0 # https://github.com/joke2k/django-environ django-environ==0.9.0 # https://github.com/joke2k/django-environ
django-model-utils==4.2.0 # https://github.com/jazzband/django-model-utils django-model-utils==4.2.0 # https://github.com/jazzband/django-model-utils
django-allauth==0.51.0 # https://github.com/pennersr/django-allauth django-allauth==0.51.0 # https://github.com/pennersr/django-allauth
django-crispy-forms==1.14.0 # https://github.com/django-crispy-forms/django-crispy-forms django-crispy-forms==1.14.0 # https://github.com/django-crispy-forms/django-crispy-forms
crispy-bootstrap5==0.6 # https://github.com/django-crispy-forms/crispy-bootstrap5 crispy-bootstrap5==0.6 # https://github.com/django-crispy-forms/crispy-bootstrap5
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
django-compressor==3.1 # https://github.com/django-compressor/django-compressor django-compressor==4.1 # https://github.com/django-compressor/django-compressor
{%- endif %} {%- endif %}
django-redis==5.2.0 # https://github.com/jazzband/django-redis django-redis==5.2.0 # https://github.com/jazzband/django-redis
{%- if cookiecutter.use_drf == 'y' %} {%- if cookiecutter.use_drf == 'y' %}
@ -44,7 +44,7 @@ django-redis==5.2.0 # https://github.com/jazzband/django-redis
djangorestframework==3.13.1 # https://github.com/encode/django-rest-framework djangorestframework==3.13.1 # https://github.com/encode/django-rest-framework
django-cors-headers==3.13.0 # https://github.com/adamchainz/django-cors-headers django-cors-headers==3.13.0 # https://github.com/adamchainz/django-cors-headers
# DRF-spectacular for api documentation # DRF-spectacular for api documentation
drf-spectacular==0.22.1 # https://github.com/tfranzel/drf-spectacular drf-spectacular==0.23.1 # https://github.com/tfranzel/drf-spectacular
{%- endif %} {%- endif %}
# Project # Project

View File

@ -1,6 +1,6 @@
-r base.txt -r base.txt
Werkzeug[watchdog]==2.0.3 # https://github.com/pallets/werkzeug Werkzeug[watchdog]==2.2.1 # https://github.com/pallets/werkzeug
ipdb==0.13.9 # https://github.com/gotcha/ipdb ipdb==0.13.9 # https://github.com/gotcha/ipdb
{%- if cookiecutter.use_docker == 'y' %} {%- if cookiecutter.use_docker == 'y' %}
psycopg2==2.9.3 # https://github.com/psycopg/psycopg2 psycopg2==2.9.3 # https://github.com/psycopg/psycopg2
@ -8,42 +8,42 @@ psycopg2==2.9.3 # https://github.com/psycopg/psycopg2
psycopg2-binary==2.9.3 # https://github.com/psycopg/psycopg2 psycopg2-binary==2.9.3 # https://github.com/psycopg/psycopg2
{%- endif %} {%- endif %}
{%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %} {%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %}
watchgod==0.8.2 # https://github.com/samuelcolvin/watchgod watchfiles==0.16.1 # https://github.com/samuelcolvin/watchfiles
{%- endif %} {%- endif %}
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
mypy==0.950 # https://github.com/python/mypy mypy==0.971 # https://github.com/python/mypy
django-stubs==1.11.0 # https://github.com/typeddjango/django-stubs django-stubs==1.12.0 # https://github.com/typeddjango/django-stubs
pytest==7.1.2 # https://github.com/pytest-dev/pytest pytest==7.1.2 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar pytest-sugar==0.9.5 # https://github.com/Frozenball/pytest-sugar
{%- if cookiecutter.use_drf == "y" %} {%- if cookiecutter.use_drf == "y" %}
djangorestframework-stubs==1.6.0 # https://github.com/typeddjango/djangorestframework-stubs djangorestframework-stubs==1.7.0 # https://github.com/typeddjango/djangorestframework-stubs
{%- endif %} {%- endif %}
# Documentation # Documentation
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
sphinx==5.0.1 # https://github.com/sphinx-doc/sphinx sphinx==5.1.1 # https://github.com/sphinx-doc/sphinx
sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild sphinx-autobuild==2021.3.14 # https://github.com/GaretJax/sphinx-autobuild
sphinx-rtd-theme==1.0.0 # https://pypi.org/project/sphinx-rtd-theme/ sphinx-rtd-theme==1.0.0 # https://pypi.org/project/sphinx-rtd-theme/
# Code quality # Code quality
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
flake8==4.0.1 # https://github.com/PyCQA/flake8 flake8==5.0.4 # https://github.com/PyCQA/flake8
flake8-isort==4.1.1 # https://github.com/gforcada/flake8-isort flake8-isort==4.2.0 # https://github.com/gforcada/flake8-isort
coverage==6.4.1 # https://github.com/nedbat/coveragepy coverage==6.4.2 # https://github.com/nedbat/coveragepy
black==22.3.0 # https://github.com/psf/black black==22.6.0 # https://github.com/psf/black
pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django
{%- if cookiecutter.use_celery == 'y' %} {%- if cookiecutter.use_celery == 'y' %}
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
{%- endif %} {%- endif %}
pre-commit==2.19.0 # https://github.com/pre-commit/pre-commit pre-commit==2.20.0 # https://github.com/pre-commit/pre-commit
# Django # Django
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
factory-boy==3.2.1 # https://github.com/FactoryBoy/factory_boy factory-boy==3.2.1 # https://github.com/FactoryBoy/factory_boy
django-debug-toolbar==3.4.0 # https://github.com/jazzband/django-debug-toolbar django-debug-toolbar==3.5.0 # https://github.com/jazzband/django-debug-toolbar
django-extensions==3.1.5 # https://github.com/django-extensions/django-extensions django-extensions==3.2.0 # https://github.com/django-extensions/django-extensions
django-coverage-plugin==2.0.3 # https://github.com/nedbat/django_coverage_plugin django-coverage-plugin==2.0.3 # https://github.com/nedbat/django_coverage_plugin
pytest-django==4.5.2 # https://github.com/pytest-dev/pytest-django pytest-django==4.5.2 # https://github.com/pytest-dev/pytest-django

View File

@ -8,7 +8,7 @@ psycopg2==2.9.3 # https://github.com/psycopg/psycopg2
Collectfast==2.2.0 # https://github.com/antonagestam/collectfast Collectfast==2.2.0 # https://github.com/antonagestam/collectfast
{%- endif %} {%- endif %}
{%- if cookiecutter.use_sentry == "y" %} {%- if cookiecutter.use_sentry == "y" %}
sentry-sdk==1.5.12 # https://github.com/getsentry/sentry-python sentry-sdk==1.9.2 # https://github.com/getsentry/sentry-python
{%- endif %} {%- endif %}
{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %}
hiredis==2.0.0 # https://github.com/redis/hiredis-py hiredis==2.0.0 # https://github.com/redis/hiredis-py

View File

@ -10,5 +10,5 @@ def media_storage(settings, tmpdir):
@pytest.fixture @pytest.fixture
def user() -> User: def user(db) -> User:
return UserFactory() return UserFactory()

View File

@ -1,4 +1,5 @@
from typing import Any, Sequence from collections.abc import Sequence
from typing import Any
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from factory import Faker, post_generation from factory import Faker, post_generation

View File

@ -1,10 +1,7 @@
import pytest
from django.urls import reverse from django.urls import reverse
from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.models import User
pytestmark = pytest.mark.django_db
class TestUserAdmin: class TestUserAdmin:
def test_changelist(self, admin_client): def test_changelist(self, admin_client):

View File

@ -1,10 +1,7 @@
import pytest
from django.urls import resolve, reverse from django.urls import resolve, reverse
from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.models import User
pytestmark = pytest.mark.django_db
def test_user_detail(user: User): def test_user_detail(user: User):
assert ( assert (

View File

@ -1,11 +1,8 @@
import pytest
from django.test import RequestFactory from django.test import RequestFactory
from {{ cookiecutter.project_slug }}.users.api.views import UserViewSet from {{ cookiecutter.project_slug }}.users.api.views import UserViewSet
from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.models import User
pytestmark = pytest.mark.django_db
class TestUserViewSet: class TestUserViewSet:
def test_get_queryset(self, user: User, rf: RequestFactory): def test_get_queryset(self, user: User, rf: RequestFactory):

View File

@ -1,14 +1,11 @@
""" """
Module for all Form Tests. Module for all Form Tests.
""" """
import pytest
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from {{ cookiecutter.project_slug }}.users.forms import UserAdminCreationForm from {{ cookiecutter.project_slug }}.users.forms import UserAdminCreationForm
from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.models import User
pytestmark = pytest.mark.django_db
class TestUserAdminCreationForm: class TestUserAdminCreationForm:
""" """

View File

@ -1,9 +1,5 @@
import pytest
from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.models import User
pytestmark = pytest.mark.django_db
def test_user_get_absolute_url(user: User): def test_user_get_absolute_url(user: User):
assert user.get_absolute_url() == f"/users/{user.uuid}/" assert user.get_absolute_url() == f"/users/{user.uuid}/"

View File

@ -1,8 +1,6 @@
import pytest import pytest
from django.urls import reverse from django.urls import reverse
pytestmark = pytest.mark.django_db
def test_swagger_accessible_by_admin(admin_client): def test_swagger_accessible_by_admin(admin_client):
url = reverse("api-docs") url = reverse("api-docs")
@ -10,6 +8,7 @@ def test_swagger_accessible_by_admin(admin_client):
assert response.status_code == 200 assert response.status_code == 200
@pytest.mark.django_db
def test_swagger_ui_not_accessible_by_normal_user(client): def test_swagger_ui_not_accessible_by_normal_user(client):
url = reverse("api-docs") url = reverse("api-docs")
response = client.get(url) response = client.get(url)

View File

@ -1,10 +1,7 @@
import pytest
from django.urls import resolve, reverse from django.urls import resolve, reverse
from {{ cookiecutter.project_slug }}.users.models import User from {{ cookiecutter.project_slug }}.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User): def test_detail(user: User):
assert ( assert (

View File

@ -64,6 +64,7 @@ class TestUserUpdateView:
# Initialize the form # Initialize the form
form = UserAdminChangeForm() form = UserAdminChangeForm()
form.cleaned_data = {} form.cleaned_data = {}
form.instance = user
view.form_valid(form) view.form_valid(form)
messages_sent = [m.message for m in messages.get_messages(request)] messages_sent = [m.message for m in messages.get_messages(request)]