aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/runtests/runtests.py
diff options
context:
space:
mode:
authorTom Christie2011-06-15 14:41:09 +0100
committerTom Christie2011-06-15 14:41:09 +0100
commit1cb84cd4e82880caea645ebd99a947cead3096b9 (patch)
tree5ae955f4a7ef5cd9754f2b5c11caecdedcad1f10 /djangorestframework/runtests/runtests.py
parentff6e78323f88fd58b1de5b02e2440c2fc24c9c8b (diff)
parent49a2817eb5ccf5f176ff5366d69df3a307dfcda2 (diff)
downloaddjango-rest-framework-1cb84cd4e82880caea645ebd99a947cead3096b9.tar.bz2
Merge throttling and fix up a coupla things
Diffstat (limited to 'djangorestframework/runtests/runtests.py')
-rw-r--r--djangorestframework/runtests/runtests.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/djangorestframework/runtests/runtests.py b/djangorestframework/runtests/runtests.py
index b98a496f..1da918f5 100644
--- a/djangorestframework/runtests/runtests.py
+++ b/djangorestframework/runtests/runtests.py
@@ -13,25 +13,27 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'djangorestframework.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)
- if hasattr(TestRunner, 'func_name'):
- # Pre 1.2 test runners were just functions,
- # and did not support the 'failfast' option.
- import warnings
- warnings.warn(
- 'Function-based test runners are deprecated. Test runners should be classes with a run_tests() method.',
- DeprecationWarning
- )
- failures = TestRunner(['djangorestframework'])
+ test_runner = TestRunner()
+ if len(sys.argv) == 2:
+ test_case = '.' + sys.argv[1]
+ elif len(sys.argv) == 1:
+ test_case = ''
else:
- test_runner = TestRunner()
- if len(sys.argv) > 1:
- test_case = '.' + sys.argv[1]
- else:
- test_case = ''
- failures = test_runner.run_tests(['djangorestframework' + test_case])
+ print usage()
+ sys.exit(1)
+ failures = test_runner.run_tests(['djangorestframework' + test_case])
sys.exit(failures)