-
-
Notifications
You must be signed in to change notification settings - Fork 306
/
manage.py
executable file
·37 lines (30 loc) · 952 Bytes
/
manage.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
37
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
environment = "production"
if os.environ.get("DEBUG", "0") == "1":
environment = "development"
try:
command = sys.argv[1]
except IndexError:
command = "help"
do_not_collect_coverage = os.environ.get("NO_COVERAGE") is not None
running_tests = command == "test"
if running_tests:
environment = "test"
if running_tests and not do_not_collect_coverage:
from coverage import Coverage
cov = Coverage()
cov.erase()
cov.start()
from django.core.management import execute_from_command_line
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", f"librephotos.settings.{environment}"
)
execute_from_command_line(sys.argv)
if running_tests and not do_not_collect_coverage:
cov.stop()
cov.save()
cov.html_report()
covered = cov.report()