mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
Bug 1564425 - Improve error handling of mach addtest, r=bgrins
Ensure that if we try to create a mochitest of unsupported file type we return a useful error Differential Revision: https://phabricator.services.mozilla.com/D38224 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
5dbd99f0b6
commit
92fb46bfa6
@ -70,12 +70,15 @@ class MochitestCreator(Creator):
|
||||
template_file_name = self.templates.get(self.suite)
|
||||
|
||||
if template_file_name is None:
|
||||
print("Sorry, `addtest` doesn't currently know how to add {}".format(self.suite))
|
||||
return None
|
||||
|
||||
template_file_name = template_file_name % {"doc": self.doc}
|
||||
|
||||
template_file = os.path.join(mochitest_templates, template_file_name)
|
||||
if not os.path.isfile(template_file):
|
||||
print("Sorry, `addtest` doesn't currently know how to add {} with document type {}"
|
||||
.format(self.suite, self.doc))
|
||||
return None
|
||||
|
||||
with open(template_file) as f:
|
||||
|
@ -193,7 +193,11 @@ class AddTest(MachCommandBase):
|
||||
creator.check_args()
|
||||
|
||||
paths = []
|
||||
added_tests = False
|
||||
for path, template in creator:
|
||||
if not template:
|
||||
continue
|
||||
added_tests = True
|
||||
if (path):
|
||||
paths.append(path)
|
||||
print("Adding a test file at {} (suite `{}`)".format(path, suite))
|
||||
@ -209,6 +213,9 @@ class AddTest(MachCommandBase):
|
||||
# write to stdout if you passed only suite and doc and not a file path
|
||||
print(template)
|
||||
|
||||
if not added_tests:
|
||||
return 1
|
||||
|
||||
if test:
|
||||
creator.update_manifest()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user