Blob Blame History Raw
From 10568067acde9a5bcb83be609de6bdeb3c07ae01 Mon Sep 17 00:00:00 2001
From: st4lk <myhappydo@gmail.com>
Date: Mon, 2 Mar 2015 14:04:24 +0300
Subject: [PATCH] set runner by option

---
 django_nose/runner.py    | 6 +++++-
 runtests.sh              | 1 +
 testapp/custom_runner.py | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 testapp/custom_runner.py

diff --git a/django_nose/runner.py b/django_nose/runner.py
index bd3c767..b99d7fb 100644
--- a/django_nose/runner.py
+++ b/django_nose/runner.py
@@ -156,6 +156,10 @@ class BasicNoseRunner(DiscoverRunner):
     # Replace the builtin command options with the merged django/nose options:
     options = _get_options()
 
+    # Not add following options to nosetests
+    django_opts = ['--noinput', '--liveserver', '-p', '--pattern',
+        '--testrunner']
+
     def run_suite(self, nose_argv):
         result_plugin = ResultPlugin()
         plugins_to_add = [DjangoSetUpPlugin(self),
@@ -208,7 +212,7 @@ def run_tests(self, test_labels, extra_tests=None):
             nose_argv.extend(settings.NOSE_ARGS)
 
         # Skip over 'manage.py test' and any arguments handled by django.
-        django_opts = ['--noinput', '--liveserver', '-p', '--pattern']
+        django_opts = self.django_opts[:]
         for opt in BaseCommand.option_list:
             django_opts.extend(opt._long_opts)
             django_opts.extend(opt._short_opts)
diff --git a/runtests.sh b/runtests.sh
index 7a0c2ce..7066672 100755
--- a/runtests.sh
+++ b/runtests.sh
@@ -47,6 +47,7 @@ django_test 'django-admin.py test --settings=testapp.settings_old_style' '2' 'dj
 django_test 'testapp/runtests.py testapp.test_only_this' '1' 'via run_tests API'
 django_test 'django-admin.py test --settings=testapp.settings_with_plugins testapp/plugin_t' '1' 'with plugins'
 django_test 'django-admin.py test --settings=testapp.settings unittests' '4' 'unittests'
+django_test 'django-admin.py test --settings=testapp.settings unittests  --testrunner=testapp.custom_runner.CustomNoseTestSuiteRunner' '4' 'unittests'
 if ! [ $(version $PYTHONVERSION) \> $(version 3.0.0) ]
 then
 # Python 3 doesn't support the hotshot profiler. See nose#842.
diff --git a/testapp/custom_runner.py b/testapp/custom_runner.py
new file mode 100644
index 0000000..b7e83ae
--- /dev/null
+++ b/testapp/custom_runner.py
@@ -0,0 +1,5 @@
+from django_nose import NoseTestSuiteRunner
+
+
+class CustomNoseTestSuiteRunner(NoseTestSuiteRunner):
+    pass