diff options
| author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-06-17 13:03:04 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-26 09:27:32 +0100 |
| commit | 35fe3117abb5885191d89e934183e211e94a71fe (patch) | |
| tree | fd0e51218cce6deb346e6e57d7a05475aa367f08 /bitbake/lib/toaster/contrib/django-aggregate-if-master/runtests.py | |
| parent | 335c975650580001b2176020c762c002bde198d6 (diff) | |
| download | poky-35fe3117abb5885191d89e934183e211e94a71fe.tar.gz | |
bitbake: toaster: add django-aggregate-if
Import library that provides conditional aggregates
in Django. The tests are removed as they conflict
with the Django startup.
The sources are
https://github.com/henriquebastos/django-aggregate-if
Licence is MIT
(Bitbake rev: 016b416fd0eaeab648a588053a2ee1f41bc02a84)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/contrib/django-aggregate-if-master/runtests.py')
| -rwxr-xr-x | bitbake/lib/toaster/contrib/django-aggregate-if-master/runtests.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/contrib/django-aggregate-if-master/runtests.py b/bitbake/lib/toaster/contrib/django-aggregate-if-master/runtests.py new file mode 100755 index 0000000000..2e55864e3a --- /dev/null +++ b/bitbake/lib/toaster/contrib/django-aggregate-if-master/runtests.py | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #!/usr/bin/env python | ||
| 2 | |||
| 3 | import os | ||
| 4 | import sys | ||
| 5 | from optparse import OptionParser | ||
| 6 | |||
| 7 | |||
| 8 | def parse_args(): | ||
| 9 | parser = OptionParser() | ||
| 10 | parser.add_option('-s', '--settings', help='Define settings.') | ||
| 11 | parser.add_option('-t', '--unittest', help='Define which test to run. Default all.') | ||
| 12 | options, args = parser.parse_args() | ||
| 13 | |||
| 14 | if not options.settings: | ||
| 15 | parser.print_help() | ||
| 16 | sys.exit(1) | ||
| 17 | |||
| 18 | if not options.unittest: | ||
| 19 | options.unittest = ['aggregation'] | ||
| 20 | |||
| 21 | return options | ||
| 22 | |||
| 23 | |||
| 24 | def get_runner(settings_module): | ||
| 25 | ''' | ||
| 26 | Asks Django for the TestRunner defined in settings or the default one. | ||
| 27 | ''' | ||
| 28 | os.environ['DJANGO_SETTINGS_MODULE'] = settings_module | ||
| 29 | |||
| 30 | import django | ||
| 31 | from django.test.utils import get_runner | ||
| 32 | from django.conf import settings | ||
| 33 | |||
| 34 | if hasattr(django, 'setup'): | ||
| 35 | django.setup() | ||
| 36 | |||
| 37 | return get_runner(settings) | ||
| 38 | |||
| 39 | |||
| 40 | def runtests(): | ||
| 41 | options = parse_args() | ||
| 42 | TestRunner = get_runner(options.settings) | ||
| 43 | runner = TestRunner(verbosity=1, interactive=True, failfast=False) | ||
| 44 | sys.exit(runner.run_tests([])) | ||
| 45 | |||
| 46 | |||
| 47 | if __name__ == '__main__': | ||
| 48 | runtests() | ||
