forked from nylas/sync-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests
executable file
·45 lines (33 loc) · 1.23 KB
/
runtests
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
#!/usr/bin/env python
import os
import argparse
import subprocess
def main():
parser = argparse.ArgumentParser(description="""
Inbox test runner. All unknown arguments are passed on to py.test.
""")
parser.add_argument('-a', '--all', dest='all', action='store_true')
parser.add_argument('-i', '--imap', dest='imap', action='store_true')
parser.add_argument('-e', '--eas', dest='eas', action='store_true')
parser.add_argument('extra', nargs='?')
args, extra_args = parser.parse_known_args()
dirname = os.path.dirname(os.path.realpath(__file__))
eastestspath = '{0}-eas/tests/eas'.format(dirname)
testrunner = ['py.test']
# Only imap tests
if args.imap:
testrunner.append('tests/imap')
# Only eas tests
elif args.eas and os.path.exists(eastestspath):
testrunner.append(eastestspath)
# All tests
elif args.all:
testrunner.append('tests/')
# Only general i.e. provider agnostic tests (Default)
else:
testrunner += ['tests/general', 'tests/api']
print 'Running tests in {0}'.format(', '.join(d for d in testrunner[1:]))
testrunner.extend(extra_args)
subprocess.check_call(testrunner)
if __name__=="__main__":
main()