-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
29 lines (23 loc) · 841 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
"""Use `py test.py` for a quick way to run pytest tox and coverage."""
import os
from subprocess import run
print('Running Coverage...')
run('venv/Scripts/python -m coverage run -m pytest', check=False)
try:
os.remove('coverage.svg')
except FileNotFoundError:
pass
run('venv/Scripts/python -m coverage_badge -o coverage.svg', check=False)
try:
os.remove('coverage.txt')
except FileNotFoundError:
pass
run('venv\\Scripts\\python -m coverage report > coverage.txt', shell=True, check=False)
run('venv/Scripts/python -m coverage report', check=False)
run('venv/Scripts/python -m coverage html', check=False)
run('cmd /c start htmlcov/index.html', check=False)
print('COVERAGE DONE')
if input('Run tox too? y/n ') == 'y':
print('Running Tox...')
run('venv/Scripts/python -m tox', check=False)
print('TOX DONE')