Add a string for translation.
[chromium-blink-merge.git] / mojo / tools / run_mojo_python_tests.py
blob2bee0abd9d71115d57d41cfa18c7f6225a7723b2
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 import optparse
7 import os
8 import sys
9 import unittest
12 # TODO(dpranke): crbug.com/364709 . We should add the ability to return
13 # JSONified results data for the bots.
16 def main():
17 parser = optparse.OptionParser()
18 parser.add_option('-v', '--verbose', action='count', default=0)
19 options, args = parser.parse_args()
20 if args:
21 parser.usage()
22 return 1
24 chromium_src_dir = os.path.join(os.path.dirname(__file__),
25 os.pardir,
26 os.pardir)
28 loader = unittest.loader.TestLoader()
29 print "Running Python unit tests under mojo/public/tools/bindings/pylib ..."
30 suite = loader.discover(os.path.join(chromium_src_dir, 'mojo', 'public',
31 'tools', 'bindings', 'pylib'),
32 pattern='*_unittest.py')
34 runner = unittest.runner.TextTestRunner(verbosity=(options.verbose+1))
35 result = runner.run(suite)
36 return 0 if result.wasSuccessful() else 1
39 if __name__ == '__main__':
40 sys.exit(main())