[docs] Fix plugin references for class-based scenarios

InfoMixin obtains documentation from objects __doc__ properties.
In case of class based scenarios, __doc__ property is empty (
we decided to use docstrings of "run" method).

This patch adds new object property - _doc_source_, which should include
object from which docstings will be used.

Change-Id: I799222fe213b96a88110d6d2ebb5aa3fe2d8f153
This commit is contained in:
Andrey Kurilin 2016-10-11 19:17:43 +03:00
parent f5f9646ba1
commit 2f99a0982b
2 changed files with 5 additions and 1 deletions

View File

@ -83,7 +83,8 @@ class InfoMixin(object):
@classmethod
def get_info(cls):
plugin_ = getattr(cls, "func_ref", cls)
doc = parse_docstring(plugin_.__doc__)
doc_source = getattr(plugin_, "_doc_source_", plugin_)
doc = parse_docstring(doc_source.__doc__)
return {
"name": plugin_.get_name(),

View File

@ -50,6 +50,9 @@ def configure(name=None, namespace="default", context=None):
scen.is_classbased = hasattr(scen, "run") and callable(scen.run)
if not scen.is_classbased:
plugin.from_func(Scenario)(scen)
else:
scen._doc_source_ = scen.run
scen._meta_init()
if name:
if "." not in name.strip("."):