forked from quantmind/dynts
/
runtests.py
executable file
·55 lines (46 loc) · 1.46 KB
/
runtests.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
#!/usr/bin/env python
import os
import sys
import dynts
from environment import pulsar
try:
import nose
from nose import plugins
def noseoption(argv,*vals,**kwargs):
if vals:
for val in vals:
if val in argv:
return
argv.append(vals[0])
value = kwargs.get('value')
if value is not None:
argv.append(value)
except ImportError:
nose = None
def start():
global pulsar
argv = sys.argv
if len(argv) > 1 and argv[1] == 'nose':
pulsar = None
sys.argv.pop(1)
if pulsar:
from pulsar.apps.test import TestSuite
from pulsar.apps.test.plugins import bench, profile
os.environ['stdnet_test_suite'] = 'pulsar'
suite = TestSuite(
description='Dynts Asynchronous test suite',
plugins=(profile.Profile(),
bench.BenchMark(),)
)
suite.start()
elif nose:
os.environ['stdnet_test_suite'] = 'nose'
argv = list(sys.argv)
noseoption(argv, '-w', value = 'tests/regression')
noseoption(argv, '--all-modules')
nose.main(argv=argv, addplugins=[NoseHttpProxy()])
else:
print('To run tests you need either pulsar or nose.')
exit(0)
if __name__ == '__main__':
start()