diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-18 20:12:01 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-05-18 20:20:11 +0300 |
commit | 37e90af76ce629c933c920232f0a801e0faa7c44 (patch) | |
tree | 25e61709afa65c759ef8f5831c7314703c530fd2 /library/python | |
parent | cf3691549bbf95f118ca8e0e15ee9c1f1c877cca (diff) | |
download | ydb-37e90af76ce629c933c920232f0a801e0faa7c44.tar.gz |
Intermediate changes
Diffstat (limited to 'library/python')
-rw-r--r-- | library/python/pytest/plugins/ya.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/library/python/pytest/plugins/ya.py b/library/python/pytest/plugins/ya.py index 191d29d76e..70ea29ddbf 100644 --- a/library/python/pytest/plugins/ya.py +++ b/library/python/pytest/plugins/ya.py @@ -142,6 +142,21 @@ def setup_logging(log_path, level=logging.DEBUG, *other_logs): root_logger.addHandler(file_handler) +class YaHookspec: + @pytest.hookspec(firstresult=True) + def pytest_ya_summarize_error(self, report): + pass + + +@pytest.hookimpl(trylast=True) +def pytest_ya_summarize_error(report): + return get_formatted_error(report) + + +def pytest_addhooks(pluginmanager): + pluginmanager.add_hookspecs(YaHookspec) + + def pytest_addoption(parser): parser.addoption("--build-root", action="store", dest="build_root", default="", help="path to the build root") parser.addoption("--dep-root", action="append", dest="dep_roots", default=[], help="path to the dep build roots") @@ -698,7 +713,9 @@ class TestItem(object): def set_error(self, entry, marker='bad'): assert entry != "" if isinstance(entry, _pytest.reports.BaseReport): - self._error = get_formatted_error(entry) + self._error = pytest_config.pluginmanager.hook.pytest_ya_summarize_error( + report=entry + ) else: self._error = "[[{}]]{}".format(yatest_lib.tools.to_str(marker), yatest_lib.tools.to_str(entry)) |