vendredi 26 juillet 2019

Is it possible to set the Allure description of a test from another language?

I am discovering tests from another language (cpp) in my pytest suite.

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)
...

I am wondering if it is possible, possibly in CatchTestItem, to set the allure description of the discovered test?

Ordinarily, the description is discovered from the docstring of the pytest function - but since these aren't pytest functions, how can I set the description for them?

Aucun commentaire:

Enregistrer un commentaire