From 4b691c402707775c3048a90531024f3bc5be6f91 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 20 Sep 2012 13:06:27 +0100 Subject: Change package name: djangorestframework -> rest_framework --- rest_framework/runtests/runtests.py | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 rest_framework/runtests/runtests.py (limited to 'rest_framework/runtests/runtests.py') diff --git a/rest_framework/runtests/runtests.py b/rest_framework/runtests/runtests.py new file mode 100755 index 00000000..b2438c9b --- /dev/null +++ b/rest_framework/runtests/runtests.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python + +# http://ericholscher.com/blog/2009/jun/29/enable-setuppy-test-your-django-apps/ +# http://www.travisswicegood.com/2010/01/17/django-virtualenv-pip-and-fabric/ +# http://code.djangoproject.com/svn/django/trunk/tests/runtests.py +import os +import sys +os.environ['DJANGO_SETTINGS_MODULE'] = 'rest_framework.runtests.settings' + +from django.conf import settings +from django.test.utils import get_runner + + +def usage(): + return """ + Usage: python runtests.py [UnitTestClass].[method] + + You can pass the Class name of the `UnitTestClass` you want to test. + + Append a method name if you only want to test a specific method of that class. + """ + + +def main(): + TestRunner = get_runner(settings) + + test_runner = TestRunner() + if len(sys.argv) == 2: + test_case = '.' + sys.argv[1] + elif len(sys.argv) == 1: + test_case = '' + else: + print usage() + sys.exit(1) + failures = test_runner.run_tests(['rest_framework' + test_case]) + + sys.exit(failures) + +if __name__ == '__main__': + main() -- cgit v1.2.3 From b9e576f16ef7cc98f671e9c18ff8ae1a95bfe3ad Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Sat, 27 Oct 2012 18:44:23 +0100 Subject: Push tests into a seperate app namespace 'rest_framework.test' Prevents tests from running by default when rest_framework is installed as 3rd party app. Fixes #316, #185 --- rest_framework/runtests/runtests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rest_framework/runtests/runtests.py') diff --git a/rest_framework/runtests/runtests.py b/rest_framework/runtests/runtests.py index b2438c9b..1bd0a5fc 100755 --- a/rest_framework/runtests/runtests.py +++ b/rest_framework/runtests/runtests.py @@ -32,7 +32,7 @@ def main(): else: print usage() sys.exit(1) - failures = test_runner.run_tests(['rest_framework' + test_case]) + failures = test_runner.run_tests(['tests' + test_case]) sys.exit(failures) -- cgit v1.2.3