forked from nshafer/django-hashid-field
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
executable file
·30 lines (27 loc) · 1.37 KB
/
runtests.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
#!/usr/bin/env python
import os
import sys
import warnings
import django
from django.conf import settings
from django.test.utils import get_runner
# Make deprecation warnings errors to ensure no usage of deprecated features.
warnings.simplefilter("error", DeprecationWarning)
warnings.simplefilter("error", PendingDeprecationWarning)
# Make runtime warning errors to ensure no usage of error prone patterns.
warnings.simplefilter("error", RuntimeWarning)
# Ignore known warnings in test dependencies.
warnings.filterwarnings("ignore", "'U' mode is deprecated", DeprecationWarning, module='docutils.io')
warnings.filterwarnings("ignore", "Using or importing the ABCs from 'collections' instead of from 'collections.abc' is "
"deprecated, and in 3.8 it will stop working", module='django')
warnings.filterwarnings("ignore", "Using or importing the ABCs from 'collections' instead of from 'collections.abc' is "
"deprecated since Python 3.3,and in 3.9 it will stop working", module='django')
if __name__ == "__main__":
print("Python:", sys.version)
print("Django:", django.get_version(django.VERSION))
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = test_runner.run_tests(sys.argv[1:] or ["tests"])
sys.exit(bool(failures))