X-Git-Url: https://git.mdrn.pl/django-pagination.git/blobdiff_plain/994531a1c248812008f698a7c2f6cfb7eddf2170..b401bf0ef7b6945ffb07f905dd59e1868a48671c:/linaro_django_pagination/tests/runner.py?ds=sidebyside diff --git a/linaro_django_pagination/tests/runner.py b/linaro_django_pagination/tests/runner.py index 44c6f69..8ef3ab9 100755 --- a/linaro_django_pagination/tests/runner.py +++ b/linaro_django_pagination/tests/runner.py @@ -1,36 +1,22 @@ #!/usr/bin/env python + import django -import doctest +import os import sys -from django.conf import settings +from django.core.management import call_command def runtests(): - if not settings.configured: - # Configure test environment - settings.configure( - SECRET_KEY='fake-key', - INSTALLED_APPS=( - 'linaro_django_pagination', - ), - ) + os.environ['DJANGO_SETTINGS_MODULE'] = 'linaro_django_pagination.tests.settings' try: django.setup() except AttributeError: # for Django 1.6 compatible pass - from django.test.utils import get_runner - - TestRunner = get_runner(settings) - test_runner = TestRunner() - failures = test_runner.run_tests( - ["linaro_django_pagination.tests"], - extra_tests=[doctest.DocTestSuite('linaro_django_pagination.tests.test_main')] - ) + failures = call_command('test', 'linaro_django_pagination') sys.exit(bool(failures)) - if __name__ == '__main__': runtests()