-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathrun_test_suite.py
65 lines (47 loc) · 1.43 KB
/
run_test_suite.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# -*- coding: utf-8 -*-
"""
Pytesting/run_tests.py
Test runner for demo app
@author: Rupert.Thomas
Created 16/11/2019
Adapted from: https://github.com/cambridgespark/pydata-testing-for-data-science
Raoul-Gabriel Urma
Run tests (from the root folder using):
python -m pytest app/tests
"""
import argparse
import os
# import urllib.request
import sys
import pytest
def run_all():
print("Running all tests...")
pytest.main(['-v', 'app/tests', '--cov-report', 'term-missing', '--cov=app/'])
def run_coverage_only():
print("Running coverage report...")
pytest.main(['--cov-report', 'term-missing', '--cov=app/', 'app/tests'])
def run_generative_only():
print("Running generative testing...")
pytest.main(['-v', 'app/tests', '--hypothesis-show-statistics', '-k', 'generative'])
def main():
parser = argparse.ArgumentParser(
description="A command line-tool to manage the project.")
parser.add_argument(
'stage',
metavar='stage',
type=str,
choices=['all', 'generative', 'coverage'],
help="Testing to run. Either: all, generative, coverage")
if len(sys.argv[1:]) == 0:
print("Running all...")
run_all()
return
stage = parser.parse_args().stage
if stage == "all":
run_all()
elif stage == "coverage":
run_coverage_only()
elif stage == "generative":
run_generative_only()
if __name__ == "__main__":
main()