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

Unified Diff: mojo/tools/mopy/mojo_python_tests_runner.py

Issue 878933003: Move the apptest runner and parts of mopy to the public SDK. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « mojo/tools/mopy/memoize.py ('k') | mojo/tools/mopy/paths.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/mopy/mojo_python_tests_runner.py
diff --git a/mojo/tools/mopy/mojo_python_tests_runner.py b/mojo/tools/mopy/mojo_python_tests_runner.py
deleted file mode 100644
index ef9a6b2b318b07fe438a8bea7ceddb3ed3430e1c..0000000000000000000000000000000000000000
--- a/mojo/tools/mopy/mojo_python_tests_runner.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# 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
-
-import mopy.paths
-
-
-class MojoPythonTestRunner(object):
- """Helper class to run python tests on the bots."""
-
- def __init__(self, test_dir):
- self._test_dir = test_dir
-
- def run(self):
- parser = argparse.ArgumentParser()
- parser.add_argument('-v', '--verbose', action='count', default=0)
- parser.add_argument('tests', nargs='*')
-
- self.add_custom_commandline_options(parser)
- args = parser.parse_args()
- self.apply_customization(args)
-
- loader = unittest.loader.TestLoader()
- print "Running Python unit tests under %s..." % self._test_dir
-
- src_root = mopy.paths.Paths().src_root
- pylib_dir = os.path.abspath(os.path.join(src_root, self._test_dir))
- if args.tests:
- if pylib_dir not in sys.path:
- sys.path.append(pylib_dir)
- suite = unittest.TestSuite()
- for test_name in args.tests:
- suite.addTests(loader.loadTestsFromName(test_name))
- else:
- suite = loader.discover(pylib_dir, pattern='*_unittest.py')
-
- runner = unittest.runner.TextTestRunner(verbosity=(args.verbose + 1))
- result = runner.run(suite)
- return 0 if result.wasSuccessful() else 1
-
- def add_custom_commandline_options(self, parser):
- """Allow to add custom option to the runner script."""
- pass
-
- def apply_customization(self, args):
- """Allow to apply any customization to the runner."""
- pass
« no previous file with comments | « mojo/tools/mopy/memoize.py ('k') | mojo/tools/mopy/paths.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698