forked from moonlitesolutions/SolrClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.py
executable file
·40 lines (35 loc) · 1.41 KB
/
run_tests.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
#!/usr/bin/env python3
# Will execute the unit tests manually and provide a better report than tox
import subprocess
import os
from pprint import pprint
import argparse
PYS = ['3.3', '3.4', '3.5']
SOLRS = ['5.2.1', '5.5.3', '6.2.1', '6.3.0']
TESTS = ['test_client', 'test_indexq', 'test_reindexer', 'test_resp',
'test_collections', 'test_zk']
parser = argparse.ArgumentParser()
parser.add_argument('-test', type=str, nargs='*', help='Which test.')
parser.add_argument('-solr', type=str, nargs='*', help='Which Solr.')
parser.add_argument('-py', type=str, nargs='*', help='PY')
args = parser.parse_args()
if args.test:
TESTS = args.test
if args.solr:
SOLRS = args.solr
if args.py:
PYS = args.py
print("Starting Testing")
REPORT = {}
for ver in PYS:
res = subprocess.call(["python3", "/usr/local/bin/tox", "-e", "py{}".format(ver.replace('.', ''))])
python = '.tox/py{}/bin/python{}'.format(ver.replace('.', ''), ver)
subprocess.call([".tox/py{}/bin/pip".format(ver.replace('.', '')), "install", "-r", "requirements.txt"])
REPORT[ver] = {}
for solr in SOLRS:
REPORT[ver][solr] = {}
os.environ['SOLR_TEST_URL'] = 'http://localhost:9{}/solr/'.format(solr.replace('.', ''))
for test in TESTS:
print("Running: {}- {}- {}".format(ver, solr, test))
REPORT[ver][solr][test] = subprocess.call([python, "-m", "unittest", "test.{}".format(test)])
pprint(REPORT)