Do not inialize scenario cls at scenario argument validator

Change-Id: I516d2bb46091a607122036d46ea03e7ae3ba0a67
This commit is contained in:
Andrey Kurilin 2020-05-07 15:29:17 +03:00
parent b9c303c2f4
commit 166435fb4f
2 changed files with 13 additions and 4 deletions

View File

@ -20,6 +20,12 @@ Changelog
[unreleased]
------------
Changed
~~~~~~~
* Validator for scenario arguments do not initialize scenario class anymore for
discovering argument spec of the *run* method.
Fixed
~~~~~

View File

@ -43,11 +43,14 @@ class ArgsValidator(validation.Validator):
name = scenario.get_name()
platform = scenario.get_platform()
args_spec = inspect.signature(scenario().run).parameters
args_spec = inspect.signature(scenario.run).parameters
missed_args = [
p.name for p in args_spec.values()
if p.default == inspect.Parameter.empty
and p.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD]
p.name
for i, p in enumerate(args_spec.values())
if (i != 0 # first argument is self-argument, i.e instance of cls
and p.default == inspect.Parameter.empty
and p.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD)
]
hint_msg = (" Use `rally plugin show --name %s --platform %s` "
"to display scenario description." % (name, platform))