forked from schemaorg/schemaorg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.py
executable file
·39 lines (31 loc) · 1.26 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
#!/usr/bin/env python
import optparse
import sys
from os import path
from os.path import expanduser
import unittest
import argparse
# Simple stand-alone test runner
# - Runs independently of appengine runner
# - So we need to find the GAE library
# - Looks for tests as ./tests/test*.py
# - Use --skipbasics to skip the most basic tests and run only tests/test_graphs*.py
#
# see https://developers.google.com/appengine/docs/python/tools/localunittesting
#
# Alt: python -m unittest discover -s tests/ -p 'test_*.py' (problem as needs GAE files)
def main(sdk_path, test_path, args):
sys.path.insert(0, sdk_path)
import dev_appserver
dev_appserver.fix_sys_path()
print args, test_path
if vars(args)["skipbasics"]:
suite = unittest.loader.TestLoader().discover(test_path, pattern="test_graphs*.py")
else:
suite = unittest.loader.TestLoader().discover(test_path)
unittest.TextTestRunner(verbosity=2).run(suite)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Configurable testing of schema.org.')
parser.add_argument('--skipbasics', action='store_true', help='Skip basic tests.')
args = parser.parse_args()
main(expanduser("~") + '/google-cloud-sdk/platform/google_appengine/', './tests/', args)