File: tests.py

package info (click to toggle)
python-django-ical 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 264 kB
  • sloc: python: 1,307; makefile: 132; sh: 2
file content (29 lines) | stat: -rw-r--r-- 663 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import sys


def main():
    """
    Standalone Django model test with a 'memory-only-django-installation'.
    You can play with a django model without a complete django app installation.
    http://www.djangosnippets.org/snippets/1044/
    """

    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_settings")
    print(os.environ)

    import django
    from django.conf import settings

    django.setup()

    from django.test.utils import get_runner

    TestRunner = get_runner(settings)
    test_runner = TestRunner()
    failures = test_runner.run_tests(["django_ical"])
    sys.exit(bool(failures))


if __name__ == "__main__":
    main()