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
--- 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)