-
Notifications
You must be signed in to change notification settings - Fork 56
/
travisTests.py
executable file
·67 lines (50 loc) · 1.94 KB
/
travisTests.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
66
67
#!/usr/bin/env python3
from __future__ import print_function
from runTests import run_tests
from helpers.automation_tools import get_branchname
import os, sys
def check_env(varname):
return os.environ.get(varname, 'False') == 'True'
doReport = check_env('Report')
doReportB = check_env('ReportB')
doDrivers = check_env('Drivers')
doDefault = check_env('Default')
doMPI = check_env('MPI')
doAlgorithms = check_env('Algorithms')
doAlgorithmsB = check_env('AlgorithmsB')
# I'm doing string comparison rather than boolean comparison because, in python, bool('False') evaluates to true
# Build the list of packages to test depending on which portion of the build matrix is running
tests = [] # Run nothing if no environment variables are set
parallel = True # By default
package = 'pygsti' # Check coverage of all of pygsti by default
# All other reports tests
if doReport:
tests = ['report']
package = 'pygsti.report'
elif doReportB:
tests = ['reportb']
package = 'pygsti.report'
elif doDrivers:
tests = ['drivers', 'objects']
elif doAlgorithms:
#parallel = False
tests = ['algorithms']
package = 'pygsti.algorithms'
elif doAlgorithmsB:
#parallel = False
tests = ['algorithmsb']
package = 'pygsti.algorithms'
elif doDefault:
tests = ['tools', 'iotest', 'optimize', 'construction','extras']
#parallel = False #multiprocessing bug in darwin (and apparently TravisCI) causes segfault if used.
elif doMPI:
tests = ['mpi']
parallel = False # Not for mpi
print('Running travis tests with python%s.%s' % (sys.version_info[0], sys.version_info[1]))
coverage = True
branchname = get_branchname()
print('Branchname is %s' % branchname)
threshold = 0 # Isn't representative of full coverage anyways
if branchname == 'develop':
coverage = False
run_tests(tests, parallel=parallel, coverage=coverage, threshold=threshold, outputfile='../output/test.out', package=package)