-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathruntests.py
More file actions
executable file
·33 lines (22 loc) · 917 Bytes
/
runtests.py
File metadata and controls
executable file
·33 lines (22 loc) · 917 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
#!/usr/bin/env python
import argparse
import os
import sys
import pytest
def main():
os.environ['APP_ENV'] = 'testing'
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--debug-level', default='info', choices=('debug', 'info', 'warning', 'error'))
parser.add_argument('--coverage', action='store_true', default=False)
parser.add_argument('--coverage-html', '--cov-html', action='store_true', default=False)
args, pytest_args = parser.parse_known_args()
use_coverage = args.coverage or args.coverage_html
if use_coverage:
pytest_args.extend(['--cov', 'bnbarb'])
if args.coverage_html:
pytest_args.extend(['--cov-report', 'html', '--cov-report', 'term'])
print('--> Calling pytest with args: {}'.format(' '.join(pytest_args)))
status = pytest.main(pytest_args)
sys.exit(status)
if __name__ == '__main__':
main()