summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authordpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 05:25:49 +0000
committerdpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 05:25:49 +0000
commit45cba48ea96ef662998d812f33d4d4f0cd70cf55 (patch)
tree371cdd0c1b66ee6298c366afb60b381f0149cd80 /mojo
parentcf9b1b9e292528c77b78a0c4718e0572b5f6dd53 (diff)
downloadchromium_src-45cba48ea96ef662998d812f33d4d4f0cd70cf55.zip
chromium_src-45cba48ea96ef662998d812f33d4d4f0cd70cf55.tar.gz
chromium_src-45cba48ea96ef662998d812f33d4d4f0cd70cf55.tar.bz2
Add run_mojo_python_tests.py so that we can run the python tests on the bots.
The bots would strongly prefer to call python directly rather than route through the mojob.sh shell script. R=viettrungluu@chromium.org, sky@chromium.org BUG=364709 Review URL: https://codereview.chromium.org/241713003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rwxr-xr-xmojo/tools/mojob.sh4
-rwxr-xr-xmojo/tools/run_mojo_python_tests.py40
2 files changed, 41 insertions, 3 deletions
diff --git a/mojo/tools/mojob.sh b/mojo/tools/mojob.sh
index 291012c..b870cd1 100755
--- a/mojo/tools/mojob.sh
+++ b/mojo/tools/mojob.sh
@@ -61,9 +61,7 @@ do_perftests() {
}
do_pytests() {
- echo "Running Python unit tests under mojo/public/tools/bindings/pylib ..."
- python -m unittest \
- discover -s mojo/public/tools/bindings/pylib -p "*_unittest.py"
+ python mojo/tools/run_mojo_python_tests.py || exit 1
}
do_gyp() {
diff --git a/mojo/tools/run_mojo_python_tests.py b/mojo/tools/run_mojo_python_tests.py
new file mode 100755
index 0000000..48b723c
--- /dev/null
+++ b/mojo/tools/run_mojo_python_tests.py
@@ -0,0 +1,40 @@
+#!/bin/python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import optparse
+import os
+import sys
+import unittest
+
+
+# TODO(dpranke): crbug.com/364709 . We should add the ability to return
+# JSONified results data for the bots.
+
+
+def main():
+ parser = optparse.OptionParser()
+ parser.add_option('-v', '--verbose', action='count', default=0)
+ options, args = parser.parse_args()
+ if args:
+ parser.usage()
+ return 1
+
+ chromium_src_dir = os.path.join(os.path.dirname(__file__),
+ os.pardir,
+ os.pardir)
+
+ loader = unittest.loader.TestLoader()
+ print "Running Python unit tests under mojo/public/tools/bindings/pylib ..."
+ suite = loader.discover(os.path.join(chromium_src_dir, 'mojo', 'public',
+ 'tools', 'bindings', 'pylib'),
+ pattern='*_unittest.py')
+
+ runner = unittest.runner.TextTestRunner(verbosity=(options.verbose+1))
+ result = runner.run(suite)
+ return 0 if result.wasSuccessful() else 1
+
+
+if __name__ == '__main__':
+ sys.exit(main())