[Python-modules-commits] [python-django] 01/02: Add DEP-8 test suite.

Raphaël Hertzog hertzog at moszumanska.debian.org
Sun Sep 25 12:19:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

hertzog pushed a commit to branch debian/jessie
in repository python-django.

commit cc3c00e77fb9732e80edd3f4a1744cc50a346265
Author: Raphaël Hertzog <hertzog at debian.org>
Date:   Mon Jul 25 11:00:35 2016 +0200

    Add DEP-8 test suite.
---
 debian/changelog          |  1 +
 debian/tests/control      |  9 +++++++++
 debian/tests/django-admin | 42 ++++++++++++++++++++++++++++++++++++++++++
 debian/tests/test-suite   | 11 +++++++++++
 4 files changed, 63 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c081e32..c2c885d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,7 @@ python-django (1.7.11-1) jessie; urgency=medium
   * 1.7.11 fixes:
     - Fixed a data loss possibility with Prefetch if to_attr is set to a
       ManyToManyField (#25693).
+  * Add DEP-8 test suite.
 
  -- Raphaël Hertzog <hertzog at debian.org>  Mon, 25 Jul 2016 09:37:20 +0200
 
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..d62e0c1
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,9 @@
+Test-Command: debian/tests/django-admin --with python2
+Depends: python-django
+
+Test-Command: debian/tests/django-admin --with python3
+Depends: python3-django
+
+Test-Command: debian/tests/test-suite python2 python3
+Restrictions: allow-stderr, needs-recommends
+Depends: @, @builddeps@
diff --git a/debian/tests/django-admin b/debian/tests/django-admin
new file mode 100755
index 0000000..e27bda1
--- /dev/null
+++ b/debian/tests/django-admin
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -e
+
+ensure_files_exist() {
+    for f in "$@"; do
+	if [ ! -e $f ]; then
+	    echo "ERROR: $f does not exist" >&2
+	    exit 1
+	else
+	    echo "OK: $f is there"
+	fi
+    done
+}
+
+run() {
+    echo "Running “$@”"
+    $@
+}
+
+# Test startproject
+cd $ADTTMP
+run django-admin startproject testproject
+
+ensure_files_exist testproject/manage.py testproject/testproject/settings.py
+
+# Test startapp
+cd testproject
+run django-admin startapp testapp
+
+ensure_files_exist testapp/models.py testapp/tests.py testapp/views.py
+
+# Test manage.py
+#./manage.py check
+
+# Needed because upstream doesn't want to rewrite shebang of ./manage.py
+# see https://code.djangoproject.com/ticket/20027
+if [ -e /usr/bin/python ]; then
+    ./manage.py check
+else
+    python3 ./manage.py check
+fi
diff --git a/debian/tests/test-suite b/debian/tests/test-suite
new file mode 100755
index 0000000..edc5740
--- /dev/null
+++ b/debian/tests/test-suite
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+cp -a tests $ADTTMP/tests
+cd $ADTTMP/tests
+
+for python in "$@"; do
+    echo "Running “$python ./runtests.py --verbosity 2”"
+    LC_ALL=C.UTF-8 $python ./runtests.py --verbosity 2
+done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django.git



More information about the Python-modules-commits mailing list