我在pytest套件中发现了另一种语言(cpp)的测试。
class CatchTestItem(pytest.Item):
def __init__(self, name, parent, test):
super(CatchTestItem, self).__init__(name, parent)
self.test = test
self.add_marker('catch_test')
self.__doc__ = test[3]
self.tags = test[4]
def runtest(self):
pass
def reportinfo(self):
return self.fspath, self.test[2], self.name, self.test[3]
class CatchTestFile(pytest.File):
def __init__(self, fspath, executable_path, parent=None, config=None, session=None, nodeid=None):
self.tests = []
self.executable_path = executable_path
super(self.__class__, self).__init__(fspath, parent, config, session, nodeid)
def _add_test(self, test_name, test_path, test_line, test_desc, test_tags):
self.tests.append((test_name, test_path, test_line, test_tags, test_desc))
def collect(self):
test_exe = str(self.executable_path)
...
我想知道是否有可能在CatchTestItem中设置所发现测试的吸引力描述?
通常,描述是从pytest函数的文档字符串中发现的-但由于这些不是pytest函数,我如何为它们设置描述?