forked from quantmind/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
52 lines (44 loc) · 1.58 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
#!/usr/bin/env python
import sys
import os
from multiprocessing import current_process
def run(**params):
args = params.get('argv', sys.argv)
if '--coveralls' in args:
import pulsar
from pulsar.utils.path import Path
from pulsar.apps.test.cov import coveralls
repo_token = None
strip_dirs = [Path(pulsar.__file__).parent.parent, os.getcwd()]
if os.path.isfile('.coveralls-repo-token'):
with open('.coveralls-repo-token') as f:
repo_token = f.read().strip()
coveralls(strip_dirs=strip_dirs, repo_token=repo_token)
sys.exit(0)
# Run the test suite
if '--coverage' in args:
import coverage
p = current_process()
p._coverage = coverage.coverage(data_suffix=True)
p._coverage.start()
runtests(**params)
def runtests(debug=True, **params):
from pulsar.apps.test import TestSuite
from pulsar.apps.test.plugins import bench, profile
import pulsar.utils.settings.backend # noqa
djangopath = os.path.join(os.path.dirname(__file__),
'examples', 'djchat')
if djangopath not in sys.path:
sys.path.append(djangopath)
#
TestSuite(description='Pulsar Asynchronous test suite',
modules=('tests',
('examples', 'tests'),
('examples', 'test_*')),
plugins=(bench.BenchMark(),
profile.Profile()),
pidfile='test.pid',
debug=debug,
**params).start()
if __name__ == '__main__':
run()