[Python-modules-commits] [python-django] 09/10: Add some DEP-8 tests

Raphaël Hertzog hertzog at moszumanska.debian.org
Tue Jan 5 13:37:24 UTC 2016


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

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

commit 6e52f537a1855bc8d5743bda0aa2653e0cd4db70
Author: Raphaël Hertzog <hertzog at debian.org>
Date:   Wed Dec 30 16:04:19 2015 +0100

    Add some DEP-8 tests
    
    They test "django-admin" and run the test suite against the installed
    package. In both cases, we do it with python2 and python3.
---
 debian/changelog              |  3 +++
 debian/tests/control          |  9 +++++++++
 debian/tests/django-admin     | 45 +++++++++++++++++++++++++++++++++++++++++++
 debian/tests/django-admin-py3 |  1 +
 debian/tests/test-suite       | 18 +++++++++++++++++
 debian/tests/test-suite-py3   |  1 +
 6 files changed, 77 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1bdae21..c95e2e4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
 python-django (1.8.8-1~bpo8+1) jessie-backports; urgency=medium
 
   * New upstream release of Django 1.8.x (LTS version).
+  * Add some DEP-8 tests testing "django-admin" and running the test suite
+    against the installed package. In both cases, we do it with python2 and
+    python3.
 
  -- Raphaël Hertzog <hertzog at debian.org>  Tue, 05 Jan 2016 10:57:29 +0100
 
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..60eccf2
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,9 @@
+Tests: django-admin
+Depends: python-django
+
+Tests: django-admin-py3
+Depends: python3-django
+
+Tests: test-suite, test-suite-py3
+Restrictions: allow-stderr, needs-recommends
+Depends: @, @builddeps@
diff --git a/debian/tests/django-admin b/debian/tests/django-admin
new file mode 100644
index 0000000..41c3246
--- /dev/null
+++ b/debian/tests/django-admin
@@ -0,0 +1,45 @@
+#!/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 “$@”"
+    $@
+}
+
+case $0 in
+    *-py3)
+        python=python3
+        ;;
+    *)
+        python=python2
+        ;;
+esac
+
+# 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 hardcodes python3, so we have to call the correct/available
+# python interpreter explicitly
+run $python ./manage.py check
diff --git a/debian/tests/django-admin-py3 b/debian/tests/django-admin-py3
new file mode 120000
index 0000000..1898c7d
--- /dev/null
+++ b/debian/tests/django-admin-py3
@@ -0,0 +1 @@
+django-admin
\ No newline at end of file
diff --git a/debian/tests/test-suite b/debian/tests/test-suite
new file mode 100644
index 0000000..8757deb
--- /dev/null
+++ b/debian/tests/test-suite
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+case $0 in
+    *-py3)
+	python=python3
+	;;
+    *)
+	python=python2
+	;;
+esac
+
+cp -a tests $ADTTMP/django-tests
+cd $ADTTMP/django-tests
+
+echo "Running “$python ./runtests.py --verbosity 2”"
+LC_ALL=C.UTF-8 $python ./runtests.py --verbosity 2 --parallel 1
diff --git a/debian/tests/test-suite-py3 b/debian/tests/test-suite-py3
new file mode 120000
index 0000000..a81fe93
--- /dev/null
+++ b/debian/tests/test-suite-py3
@@ -0,0 +1 @@
+test-suite
\ No newline at end of file

-- 
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