Add a --skip-tests option to the unittest_suite this can be used with --full to 
limit tests on a conditional basis (it is mostly used inside of other scripts). 

Signed-off-by: Scott Zawalski <[email protected]>

--- autotest/utils/unittest_suite.py    2010-02-10 18:24:00.000000000 -0800
+++ autotest/utils/unittest_suite.py    2010-02-18 13:33:15.000000000 -0800
@@ -13,6 +13,9 @@
                   help="whether to run the shortened version of the test")
 parser.add_option("--debug", action="store_true", dest="debug", default=False,
                   help="run in debug mode")
+parser.add_option("--skip-tests", dest="skip_tests",  default=[],
+                  help="A space separated list of tests to skip")
+
 
 LONG_TESTS = set((
     'monitor_db_unittest.py',
@@ -31,6 +34,7 @@
     'scheduler_models_unittest.py',
     ))
 
+
 ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
 
 
@@ -69,6 +73,9 @@
     @param options: optparse options.
     """
     modules = []
+    skip_tests = set()
+    if options.skip_tests:
+        skip_tests.update(options.skip_tests.split())
 
     for dirpath, subdirs, filenames in os.walk(start):
         # Only look in and below subdirectories that are python modules.
@@ -88,6 +95,8 @@
             if fname.endswith('_unittest.py') or fname.endswith('_test.py'):
                 if not options.full and fname in LONG_TESTS:
                     continue
+                if fname in skip_tests:
+                    continue
                 path_no_py = os.path.join(dirpath, fname).rstrip('.py')
                 assert path_no_py.startswith(ROOT)
                 names = path_no_py[len(ROOT)+1:].split('/')
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to