Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: build/android/python_test_runner.py

Issue 660023002: [Android] Test runner for python unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: + copyright header Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/python_test_runner.py
diff --git a/build/android/python_test_runner.py b/build/android/python_test_runner.py
new file mode 100644
index 0000000000000000000000000000000000000000..2f7433305e54e8d86905db1c818b23ca38eaaca3
--- /dev/null
+++ b/build/android/python_test_runner.py
@@ -0,0 +1,48 @@
+# 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 argparse
+import os
+import sys
+import unittest
+
+from pylib import constants
+
+PYTHON_UNIT_TESTS = {
+ os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android'): [
+ 'pylib.device.device_utils_test',
+ ],
+ # TODO(mkosiba): Reenable after fixing these.
klundberg 2014/10/16 17:50:15 This seems a bit weird in a new file (the "reenabl
jbudorick 2014/10/16 17:55:07 Hah, no. This CL was motivated by an offline conve
+ # os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'android', 'gyp'): [
+ # 'java_cpp_enum_tests'
+ # ]
+}
+
+
+def main():
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-v', '--verbose', action='count')
+ args = parser.parse_args()
+
+ passed = True
+
+ for path, modules in PYTHON_UNIT_TESTS.iteritems():
+ sys.path = [path] + sys.path
+ try:
+ suite = unittest.TestSuite()
+ suite.addTests(unittest.defaultTestLoader.loadTestsFromName(m)
+ for m in modules)
+ runner = unittest.TextTestRunner(verbosity=args.verbose)
+ passed = (runner.run(suite).wasSuccessful()
+ and passed)
+ finally:
+ sys.path = sys.path[1:]
+
+ return 0 if passed else 1
+
+
+if __name__ == '__main__':
+ sys.exit(main())
+
« build/android/buildbot/bb_device_steps.py ('K') | « build/android/buildbot/bb_run_bot.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698