blob: 159726ea938cf8f54610bcb34c5139eb8c93673b (
plain)
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
|
import subprocess as sp
from squad_client.core.api import SquadApi
from .squad_service import SquadService
def run(coverage=False, tests=['discover'], verbose=False):
squad_service = SquadService()
if not squad_service.start() or not squad_service.apply_fixtures('tests/fixtures.py'):
print('Aborting tests!')
return False
SquadApi.configure(url=squad_service.host)
argv = ['-m', 'unittest'] + tests
if len(tests) == 0 and verbose:
argv += ['discover', '-v']
if coverage:
print('\t --coverage is enabled, run `coverage report -m` to view coverage report')
argv = ['coverage', 'run', '--source', 'squad_client'] + argv
else:
argv = ['python3'] + argv
proc = sp.Popen(argv)
proc.wait()
squad_service.stop()
return proc.returncode == 0
|