forked from django-guardian/django-guardian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
37 lines (29 loc) · 903 Bytes
/
tests.py
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
30
31
32
33
34
35
36
"""
Unit tests runner for ``django-guardian`` based on boundled example project.
Tests are independent from this example application but setuptools need
instructions how to interpret ``test`` command when we run::
python setup.py test
"""
import os
import sys
os.environ["DJANGO_SETTINGS_MODULE"] = 'example_project.settings'
from example_project import settings
settings.DJALOG_LEVEL = 40
settings.INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.flatpages',
'guardian',
'guardian.tests.app',
'richtemplates',
)
def main():
from django.test.utils import get_runner
test_runner = get_runner(settings)(interactive=False)
failures = test_runner.run_tests(['guardian'])
sys.exit(failures)
if __name__ == '__main__':
main()