forked from mytardis/mytardis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
executable file
·29 lines (22 loc) · 808 Bytes
/
test.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
#!/usr/bin/env python
import os
import sys
import coverage
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tardis.test_settings")
from django.core.management import execute_from_command_line
# https://github.com/django-nose/django-nose/issues/180#issuecomment-93371418
# Without this, coverage reporting starts after many modules have
# already been imported, so module-level code is excluded from
# coverage reports:
cov = coverage.coverage(source=['tardis'], omit=['*/tests/*'])
cov.set_option('report:show_missing', True)
cov.erase()
cov.start()
if len(sys.argv) < 2:
execute_from_command_line(['./test.py', 'test'])
else:
execute_from_command_line(sys.argv)
cov.stop()
cov.save()
cov.report()