forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_regression.py
More file actions
37 lines (28 loc) · 1.01 KB
/
Copy pathrun_regression.py
File metadata and controls
37 lines (28 loc) · 1.01 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
import argparse
import sys
import unittest2
# This assumes the command is being run via tox hence the
# repository root is the current directory.
from regression import regression_utils
def get_parser():
parser = argparse.ArgumentParser(
description='GCloud test runner against actual project.')
parser.add_argument('--package', dest='package',
choices=('datastore',),
default='datastore', help='Package to be tested.')
return parser
def run_module_tests(module_name):
suite = unittest2.TestSuite()
tests = unittest2.defaultTestLoader.loadTestsFromName(module_name)
suite.addTest(tests)
return unittest2.TextTestRunner(verbosity=2).run(suite)
def main():
parser = get_parser()
args = parser.parse_args()
# Make sure environ is set before running test.
regression_utils.get_environ()
test_result = run_module_tests(args.package)
if not test_result.wasSuccessful():
sys.exit(1)
if __name__ == '__main__':
main()