forked from mytardis/mytardis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
executable file
·32 lines (24 loc) · 973 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
30
31
32
#!/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)
if len(sys.argv) > 1 and sys.argv[1] == "behave":
cov.set_option("run:plugins", ["django_coverage_plugin"])
cov.set_option("report:include", ["*.html", "*.js"])
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()