This repository was archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathruntests.py
More file actions
executable file
·67 lines (60 loc) · 1.83 KB
/
runtests.py
File metadata and controls
executable file
·67 lines (60 loc) · 1.83 KB
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 python
'''Stdnet asynchronous test suite. Requires pulsar.'''
import sys
import os
from multiprocessing import current_process
## This is for dev environment with pulsar and dynts.
## If not available, some tests won't run
p = os.path
dir = p.dirname(p.dirname(p.abspath(__file__)))
try:
import pulsar
except ImportError:
pdir = p.join(dir, 'pulsar')
if os.path.isdir(pdir):
sys.path.append(pdir)
import pulsar
from pulsar.apps.test import TestSuite
from pulsar.apps.test.plugins import bench, profile
from pulsar.utils.path import Path
#
try:
import dynts
except ImportError:
pdir = p.join(dir, 'dynts')
if os.path.isdir(pdir):
sys.path.append(pdir)
try:
import dynts
except ImportError:
pass
def run(**params):
args = params.get('argv', sys.argv)
if '--coverage' in args or params.get('coverage'):
import coverage
p = current_process()
p._coverage = coverage.coverage(data_suffix=True)
p._coverage.start()
runtests(**params)
def runtests(**params):
import stdnet
from stdnet.utils import test
#
strip_dirs = [Path(stdnet.__file__).parent.parent, os.getcwd()]
#
suite = TestSuite(description='Stdnet Asynchronous test suite',
modules=('tests.all',),
plugins=(test.StdnetPlugin(),
bench.BenchMark(),
profile.Profile()),
**params)
suite.bind_event('tests', test.create_tests)
suite.start()
#
if suite.cfg.coveralls:
from pulsar.utils.cov import coveralls
coveralls(strip_dirs=strip_dirs,
stream=suite.stream,
repo_token='ZQinNe5XNbzQ44xYGTljP8R89jrQ5xTKB')
if __name__ == '__main__':
run()