diff options
| author | markotibold | 2011-03-19 03:04:22 +0100 | 
|---|---|---|
| committer | markotibold | 2011-03-19 03:04:22 +0100 | 
| commit | 921519732728633517769eaa4a999f08100ce77d (patch) | |
| tree | 79af036cea766e131ba37415d0f250077e9af945 /examples | |
| parent | fabf7c255d33f3b187a7e40f3c94ac9cb8c3e5e2 (diff) | |
| download | django-rest-framework-921519732728633517769eaa4a999f08100ce77d.tar.bz2 | |
Adding examples to tox.  Appears quite useful cause some example tests are broken.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/runtests.py | 27 | ||||
| -rw-r--r-- | examples/settings.py | 5 | 
2 files changed, 32 insertions, 0 deletions
diff --git a/examples/runtests.py b/examples/runtests.py new file mode 100644 index 00000000..fd79bc64 --- /dev/null +++ b/examples/runtests.py @@ -0,0 +1,27 @@ +import os +import sys +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' + +from django.conf import settings +from django.test.utils import get_runner + +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(None) +    else: +        test_runner = TestRunner() +        failures = test_runner.run_tests(None) + +    sys.exit(failures) + +if __name__ == '__main__': +    main() diff --git a/examples/settings.py b/examples/settings.py index c4cdd992..d38ab425 100644 --- a/examples/settings.py +++ b/examples/settings.py @@ -105,3 +105,8 @@ INSTALLED_APPS = (      'pygments_api',      'blogpost',  ) + +TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner' +TEST_OUTPUT_VERBOSE = True +TEST_OUTPUT_DESCRIPTIONS = True +TEST_OUTPUT_DIR = 'xmlrunner'
\ No newline at end of file  | 
