-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathruntests.py
More file actions
executable file
·38 lines (31 loc) · 926 Bytes
/
runtests.py
File metadata and controls
executable file
·38 lines (31 loc) · 926 Bytes
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
38
#!/usr/bin/env python
import os
import sys
import pytest
import coverage
if __name__ == '__main__':
# Environment variables
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'strongMan.settings.local')
measure_coverage = True
if '--no-cov' in sys.argv:
measure_coverage = False
sys.argv.remove('--no-cov')
def_args = ['strongMan/apps', 'strongMan/helper_apps', 'strongMan/tests/tests']
if '--no-vici' in sys.argv:
def_args.append('--ignore=strongMan/tests/tests/vici/')
sys.argv.remove('--no-vici')
# Start coverage tracking
if measure_coverage:
cov = coverage.coverage()
cov.start()
# Run pytest
if len(sys.argv) > 1:
code = pytest.main(sys.argv)
else:
code = pytest.main(def_args)
# Show coverage report
if measure_coverage:
cov.stop()
cov.save()
cov.report()
sys.exit(code)