зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635930 - Activate a layer when its options are used. r=sparky,tarek
Differential Revision: https://phabricator.services.mozilla.com/D83551
This commit is contained in:
Родитель
9f220fdcc4
Коммит
210c0b2307
|
@ -126,3 +126,19 @@ class PerftestArgumentParser(ArgumentParser):
|
|||
self.add_argument(name, **options)
|
||||
|
||||
mozlog.commandline.add_logging_group(self)
|
||||
|
||||
def parse_helper(self, args):
|
||||
for arg in args:
|
||||
arg_part = arg.partition("--")[-1].partition("-")
|
||||
layer_name = f"--{arg_part[0]}"
|
||||
layer_exists = arg_part[1] and layer_name in Options.args
|
||||
if layer_exists:
|
||||
args.append(layer_name)
|
||||
|
||||
def parse_args(self, args=None, namespace=None):
|
||||
self.parse_helper(args)
|
||||
return super().parse_args(args, namespace)
|
||||
|
||||
def parse_known_args(self, args=None, namespace=None):
|
||||
self.parse_helper(args)
|
||||
return super().parse_known_args(args, namespace)
|
||||
|
|
|
@ -23,6 +23,16 @@ def test_options():
|
|||
)
|
||||
|
||||
|
||||
def test_layer_option():
|
||||
parser = PerftestArgumentParser()
|
||||
assert parser.parse_args(["--notebook-metrics"]) == parser.parse_args(
|
||||
["--notebook-metrics", "--notebook"]
|
||||
)
|
||||
assert parser.parse_known_args(["--notebook-metrics"]) == parser.parse_known_args(
|
||||
["--notebook-metrics", "--notebook"]
|
||||
)
|
||||
|
||||
|
||||
def test_bad_test_date():
|
||||
parser = PerftestArgumentParser()
|
||||
args = ["test_one.js", "--test-date", "bleh"]
|
||||
|
|
Загрузка…
Ссылка в новой задаче