Bug 1652638 - Unittests for comm_taskgraph.parameters. r=justdave
Differential Revision: https://phabricator.services.mozilla.com/D83860
This commit is contained in:
Родитель
a7be012008
Коммит
bfcf1f3c91
|
@ -1,3 +1,4 @@
|
|||
comm.pth:comm/testing/marionette
|
||||
comm.pth:comm/python/l10n
|
||||
comm.pth:comm/taskcluster
|
||||
comm.pth:comm/python/thirdroc
|
||||
|
|
|
@ -21,7 +21,10 @@ if CONFIG["MAKENSISU"]:
|
|||
if CONFIG["MOZ_BUNDLED_FONTS"]:
|
||||
DIRS += ["/%s/browser/fonts" % CONFIG["mozreltopsrcdir"]]
|
||||
|
||||
DIRS += ["../third_party"]
|
||||
DIRS += [
|
||||
"../taskcluster",
|
||||
"../third_party",
|
||||
]
|
||||
|
||||
TEST_DIRS += [
|
||||
"test/browser",
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
|
@ -0,0 +1,4 @@
|
|||
[DEFAULT]
|
||||
subsuite = comm_taskgraph
|
||||
|
||||
[test_parameters.py]
|
|
@ -0,0 +1,91 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import unittest
|
||||
|
||||
import comm_taskgraph.parameters # noqa: F401
|
||||
from taskgraph.parameters import Parameters
|
||||
from mozunit import main
|
||||
|
||||
|
||||
class TestCommParameters(unittest.TestCase):
|
||||
|
||||
vals = {
|
||||
"app_version": "app_version",
|
||||
"backstop": False,
|
||||
"base_repository": "base_repository",
|
||||
"build_date": 0,
|
||||
"build_number": 0,
|
||||
"comm_base_repository": "comm_base_repository",
|
||||
"comm_head_ref": "comm_head_ref",
|
||||
"comm_head_repository": "comm_head_repository",
|
||||
"comm_head_rev": "comm_head_rev",
|
||||
"do_not_optimize": [],
|
||||
"existing_tasks": {},
|
||||
"filters": [],
|
||||
"head_ref": "head_ref",
|
||||
"head_repository": "head_repository",
|
||||
"head_rev": "head_rev",
|
||||
"hg_branch": "hg_branch",
|
||||
"level": "level",
|
||||
"message": "message",
|
||||
"moz_build_date": "moz_build_date",
|
||||
"next_version": "next_version",
|
||||
"optimize_strategies": None,
|
||||
"optimize_target_tasks": False,
|
||||
"owner": "owner",
|
||||
"phabricator_diff": "phabricator_diff",
|
||||
"project": "project",
|
||||
"pushdate": 0,
|
||||
"pushlog_id": "pushlog_id",
|
||||
"release_enable_emefree": False,
|
||||
"release_enable_partner_repack": False,
|
||||
"release_enable_partner_attribution": False,
|
||||
"release_eta": None,
|
||||
"release_history": {},
|
||||
"release_partners": [],
|
||||
"release_partner_config": None,
|
||||
"release_partner_build_number": 1,
|
||||
"release_type": "release_type",
|
||||
"release_product": None,
|
||||
"required_signoffs": [],
|
||||
"signoff_urls": {},
|
||||
"target_tasks_method": "target_tasks_method",
|
||||
"test_manifest_loader": "default",
|
||||
"tasks_for": "tasks_for",
|
||||
"try_mode": "try_mode",
|
||||
"try_options": None,
|
||||
"try_task_config": {},
|
||||
"version": "version",
|
||||
}
|
||||
|
||||
def test_Parameters_check(self):
|
||||
"""
|
||||
Specifying all of the gecko and comm parameters doesn't result in an error.
|
||||
"""
|
||||
p = Parameters(**self.vals)
|
||||
p.check() # should not raise
|
||||
|
||||
def test_Parameters_check_missing(self):
|
||||
"""
|
||||
If any of the comm parameters are specified, all of them must be specified.
|
||||
"""
|
||||
vals = self.vals.copy()
|
||||
del vals["comm_base_repository"]
|
||||
p = Parameters(**vals)
|
||||
self.assertRaises(Exception, p.check)
|
||||
|
||||
def test_Parameters_check_extra(self):
|
||||
"""
|
||||
If parameters other than the global and comm parameters are specified,
|
||||
an error is reported.
|
||||
"""
|
||||
p = Parameters(extra="data", **self.vals)
|
||||
self.assertRaises(Exception, p.check)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,16 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Thunderbird", "Build Config")
|
||||
|
||||
PYTHON_UNITTEST_MANIFESTS += [
|
||||
"comm_taskgraph/test/python.ini",
|
||||
]
|
Загрузка…
Ссылка в новой задаче