Package: django-nose / 1.4.6-1

runtests.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From: Michael Fladischer <fladi@debian.org>
Date: Thu, 8 Oct 2015 08:54:28 -0700
Subject: Enable non-default python versions for test runs

 The original version of runtests.sh only allows running the tests on the current
 default python version. This patch add the environment variable PYTHON that can
 be set to a specific python binary (e.g. python2.6) to run the tests with.
 It also changes the path for django-admin.py to the one supplied by the
 python-django package.
Last-Update: 2011-11-26
Forwarded: no

Patch-Name: runtests.patch
---
 runtests.sh | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/runtests.sh b/runtests.sh
index da6ee27..d072fa3 100755
--- a/runtests.sh
+++ b/runtests.sh
@@ -36,8 +36,13 @@ then
 fi
 
 export PYTHONPATH=.
+if [ -z $PYTHON ]; then
+    export PYTHON=python
+fi
+
+export DJANGO_SETTINGS_MODULE=testapp.settings
 
-HAS_HOTSHOT=$(python -c "\
+HAS_HOTSHOT=$($PYTHON -c "\
 try:
   import hotshot
 except ImportError:
@@ -146,45 +151,45 @@ django_test() {
 TESTAPP_COUNT=6
 
 reset_env
-django_test "./manage.py test $NOINPUT" $TESTAPP_COUNT 'normal settings'
+django_test "$PYTHON /usr/bin/django-admin test $NOINPUT" $TESTAPP_COUNT 'normal settings'
 
 reset_env
 export TEST_RUNNER="django_nose.NoseTestSuiteRunner"
-django_test "./manage.py test $NOINPUT" $TESTAPP_COUNT 'test runner from environment'
+django_test "$PYTHON /usr/bin/django-admin test $NOINPUT" $TESTAPP_COUNT 'test runner from environment'
 
 reset_env
-django_test "testapp/runtests.py testapp.test_only_this" 1 'via run_tests API'
+django_test "$PYTHON testapp/runtests.py testapp.test_only_this" 1 'via run_tests API'
 
 reset_env
 export NOSE_PLUGINS="testapp.plugins.SanityCheckPlugin"
-django_test "./manage.py test testapp/plugin_t $NOINPUT" 1 'with plugins'
+django_test "$PYTHON /usr/bin/django-admin test testapp/plugin_t $NOINPUT" 1 'with plugins'
 
 reset_env
-django_test "./manage.py test unittests $NOINPUT" 4 'unittests'
+django_test "$PYTHON /usr/bin/django-admin test unittests $NOINPUT" 4 'unittests'
 
 reset_env
-django_test "./manage.py test unittests --verbosity 1 $NOINPUT" 4 'argument option without equals'
+django_test "$PYTHON /usr/bin/django-admin test unittests --verbosity 1 $NOINPUT" 4 'argument option without equals'
 
 reset_env
-django_test "./manage.py test unittests --nose-verbosity=2 $NOINPUT" 4 'argument with equals'
+django_test "$PYTHON /usr/bin/django-admin test unittests --nose-verbosity=2 $NOINPUT" 4 'argument with equals'
 
 reset_env
-django_test "./manage.py test unittests --testrunner=testapp.custom_runner.CustomNoseTestSuiteRunner $NOINPUT" 4 'unittests with testrunner'
+django_test "$PYTHON /usr/bin/django-admin test unittests --testrunner=testapp.custom_runner.CustomNoseTestSuiteRunner $NOINPUT" 4 'unittests with testrunner'
 
 reset_env
-django_test "./manage.py test unittests --attr special $NOINPUT" 1 'select by attribute'
+django_test "$PYTHON /usr/bin/django-admin test unittests --attr special $NOINPUT" 1 'select by attribute'
 
 reset_env
 export REUSE_DB=1
 # For the many issues with REUSE_DB=1, see:
 # https://github.com/django-nose/django-nose/milestones/Fix%20REUSE_DB=1
-django_test "./manage.py test $NOINPUT" $TESTAPP_COUNT 'with REUSE_DB=1, call #1' 'can fail'
-django_test "./manage.py test $NOINPUT" $TESTAPP_COUNT 'with REUSE_DB=1, call #2' 'can fail'
+django_test "$PYTHON /usr/bin/django-admin test $NOINPUT" $TESTAPP_COUNT 'with REUSE_DB=1, call #1' 'can fail'
+django_test "$PYTHON /usr/bin/django-admin test $NOINPUT" $TESTAPP_COUNT 'with REUSE_DB=1, call #2' 'can fail'
 
 
 if [ "$HAS_HOTSHOT" = "1" ]
 then
     # Python 3 doesn't support the hotshot profiler. See nose#842.
     reset_env
-    django_test "./manage.py test $NOINPUT --with-profile --profile-restrict less_output" $TESTAPP_COUNT 'with profile plugin'
+    django_test "$PYTHON /usr/bin/django-admin test $NOINPUT --with-profile --profile-restrict less_output" $TESTAPP_COUNT 'with profile plugin'
 fi