Projet

Général

Profil

0001-tox.ini-add-a-check-migrations.sh-script-to-check-mi.patch

Benjamin Dauvergne, 05 mai 2020 16:08

Télécharger (1,48 ko)

Voir les différences:

Subject: [PATCH 01/10] tox.ini: add a check-migrations.sh script to check
 migrations on each run (#42504)

 check-migrations.sh | 17 +++++++++++++++++
 tox.ini             |  1 +
 2 files changed, 18 insertions(+)
 create mode 100755 check-migrations.sh
check-migrations.sh
1
#!/bin/sh
2

  
3
set -e
4

  
5
APPS=$(DJANGO_SETTINGS_MODULE=authentic2.settings python -c 'from django.conf import settings; print(" ".join(p for p in (p.split(".")[-1] for p in settings.INSTALLED_APPS if not p.startswith("django.")) if p not in ["admin", "auth", "contenttypes"]))')
6
TEMPFILE=`tempfile`
7
trap "rm -f ${TEMPFILE}" EXIT
8

  
9
./authentic2-ctl makemigrations --dry-run --noinput ${APPS} >${TEMPFILE} 2>&1 || true
10

  
11
if ! grep 'No changes detected' -q ${TEMPFILE}; then
12
   echo '!!! Missing migration detected !!!'
13
   cat ${TEMPFILE}
14
   exit 1
15
else
16
   exit 0
17
fi
tox.ini
84 84
commands =
85 85
  py2: ./getlasso.sh
86 86
  py3: ./getlasso3.sh
87
  authentic: ./check-migrations.sh
87 88
  rbac,authentic: py.test {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {tty:--sw:} {posargs:{env:TESTS} --random-group}
88 89

  
89 90
[testenv:pylint]
90
-