[Python-modules-commits] [python-django] 01/08: Add some DEP-8 tests

Raphaël Hertzog hertzog at moszumanska.debian.org
Wed Dec 30 18:05:33 UTC 2015


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

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

commit d1922f57808e85920626b6c59403b4936531d244
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              |  6 ++++++
 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, 80 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 8d54af9..43ac233 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,15 @@
 python-django (1.9-2) UNRELEASED; urgency=medium
 
+  [ Chris Lamb ]
   * Use dpkg-maintscript-helper's dir_to_symlink to correctly replace the
     app_template and project_template symlinks added in 1.9~rc2-2.
     (Closes: #807683)
 
+  [ Raphaël Hertzog ]
+  * 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.
+
  -- Chris Lamb <lamby at debian.org>  Sat, 12 Dec 2015 21:02:28 +0200
 
 python-django (1.9-1) unstable; urgency=medium
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