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

Unified Diff: utils/unittest_suite.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 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
« cli/job.py ('K') | « utils/test_importer.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/unittest_suite.py
diff --git a/utils/unittest_suite.py b/utils/unittest_suite.py
index 629eba6a4c47e1e0657a7486c45d9135e6b01c9b..78a960299f77aaf508327d4bd8ad575b6cb32f5a 100755
--- a/utils/unittest_suite.py
+++ b/utils/unittest_suite.py
@@ -16,6 +16,8 @@ parser.add_option("--debug", action="store_true", dest="debug", default=False,
parser.add_option("--skip-tests", dest="skip_tests", default=[],
help="A space separated list of tests to skip")
+parser.set_defaults(module_list=None)
+
REQUIRES_DJANGO = set((
'monitor_db_unittest.py',
@@ -64,6 +66,11 @@ LONG_RUNTIME = set((
'logging_manager_test.py',
))
+# This particular KVM autotest test is not a unittest
+SKIP = set((
+ 'guest_test.py',
+ ))
+
LONG_TESTS = (REQUIRES_DJANGO |
REQUIRES_MYSQLDB |
REQUIRES_GWT |
@@ -103,16 +110,10 @@ def run_test(mod_names, options):
raise TestFailure(msg)
-def find_and_run_tests(start, options):
- """
- Find and run Python unittest suites below the given directory. Only look
- in subdirectories of start that are actual importable Python modules.
-
- @param start: The absolute directory to look for tests under.
- @param options: optparse options.
- """
+def scan_for_modules(start, options):
modules = []
- skip_tests = set()
+
+ skip_tests = SKIP
if options.skip_tests:
skip_tests.update(options.skip_tests.split())
@@ -142,6 +143,22 @@ def find_and_run_tests(start, options):
modules.append(['autotest_lib'] + names)
if options.debug:
print 'testing', path_no_py
+ return modules
+
+def find_and_run_tests(start, options):
+ """
+ Find and run Python unittest suites below the given directory. Only look
+ in subdirectories of start that are actual importable Python modules.
+
+ @param start: The absolute directory to look for tests under.
+ @param options: optparse options.
+ """
+ if options.module_list:
+ modules = []
+ for m in options.module_list:
+ modules.append(m.split('.'))
+ else:
+ modules = scan_for_modules(start, options)
if options.debug:
print 'Number of test modules found:', len(modules)
@@ -170,9 +187,7 @@ def find_and_run_tests(start, options):
def main():
options, args = parser.parse_args()
if args:
- parser.error('Unexpected argument(s): %s' % args)
- parser.print_help()
- sys.exit(1)
+ options.module_list = args
# Strip the arguments off the command line, so that the unit tests do not
# see them.
« cli/job.py ('K') | « utils/test_importer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698