frostfs-testlib/src/frostfs_testlib/reporter/interfaces.py
Andrey Berezin 39a17f3634 [#132] Add steps logger and refactor reporter usage
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
2023-11-28 09:29:07 +00:00

39 lines
1.1 KiB
Python

from abc import ABC, abstractmethod
from contextlib import AbstractContextManager, ContextDecorator
from typing import Any, Callable
class ReporterHandler(ABC):
"""Interface of handler that stores test artifacts in some reporting tool."""
@abstractmethod
def step(self, name: str) -> AbstractContextManager | ContextDecorator:
"""Register a new step in test execution.
Args:
name: Name of the step.
Returns:
Step context.
"""
@abstractmethod
def step_decorator(self, name: str) -> Callable:
"""A step decorator from reporter.
Args:
name: Name of the step.
Returns:
decorator for the step
"""
@abstractmethod
def attach(self, content: Any, file_name: str) -> None:
"""Attach specified content with given file name to the test report.
Args:
content: Content to attach. If content value is not a string, it will be
converted to a string.
file_name: File name of attachment.
"""