Bug 1237958 - Clarify Marionette's behavior re dir/manifest; r?maja_zf draft
authorAnjana Vakil <anjanavakil@gmail.com>
Wed, 08 Jun 2016 12:08:30 +0200
changeset 376757 8a2d14f138dd891be0e2984ddd58ab65d7c22252
parent 376593 f8ad071a6e14331d73fa44c8d3108bc2b66b2174
child 523231 a4b6cb2b32447d41688e1ef9d5659f31c5df71d9
push id20663
push userbmo:anjanavakil@gmail.com
push dateWed, 08 Jun 2016 17:47:41 +0000
reviewersmaja_zf
bugs1237958
milestone50.0a1
Bug 1237958 - Clarify Marionette's behavior re dir/manifest; r?maja_zf If a user specifies a directory path for Marionette tests, any manifest ('.ini') file(s) in that dir will be ignored and instead all test modules in the dir will be run. Clarify this behavior by logging a warning if an '.ini' file is found in the dir, and expanding help message for the 'tests' argument. MozReview-Commit-ID: KWxXUaO86V2
testing/marionette/harness/marionette/runner/base.py
--- a/testing/marionette/harness/marionette/runner/base.py
+++ b/testing/marionette/harness/marionette/runner/base.py
@@ -247,17 +247,21 @@ class BaseMarionetteArguments(ArgumentPa
             if not os.access(path, os.F_OK):
                 os.makedirs(path)
             return path
 
         self.argument_containers = []
         self.add_argument('tests',
                           nargs='*',
                           default=[],
-                          help='Tests to run.')
+                          help='Tests to run. '
+                               'One or more paths to test files (Python or JS), '
+                               'manifest files (.ini) or directories. '
+                               'When a directory is specified, '
+                               'all test files in the directory will be run.')
         self.add_argument('-v', '--verbose',
                         action='count',
                         help='Increase verbosity to include debug messages with -v, '
                             'and trace messages with -vv.')
         self.add_argument('--address',
                         help='host:port of running Gecko instance to connect to')
         self.add_argument('--device',
                         dest='device_serial',
@@ -884,20 +888,25 @@ setReq.onerror = function() {
         return rv
 
     def add_test(self, test, expected='pass', test_container=None):
         filepath = os.path.abspath(test)
 
         if os.path.isdir(filepath):
             for root, dirs, files in os.walk(filepath):
                 for filename in files:
-                    if (filename.startswith('test_') and
+                    if (filename.endswith('.ini')):
+                        msg_tmpl = ("Ignoring manifest '{0}'; running all tests in '{1}'."
+                                    " See --help for details.")
+                        relpath = os.path.relpath(os.path.join(root, filename), filepath)
+                        self.logger.warning(msg_tmpl.format(relpath, filepath))
+                    elif (filename.startswith('test_') and
                         (filename.endswith('.py') or filename.endswith('.js'))):
-                        filepath = os.path.join(root, filename)
-                        self.add_test(filepath)
+                        test_file = os.path.join(root, filename)
+                        self.add_test(test_file)
             return
 
 
         file_ext = os.path.splitext(os.path.split(filepath)[-1])[1]
 
         if file_ext == '.ini':
             manifest = TestManifest()
             manifest.read(filepath)