diff options
author | robot-piglet <[email protected]> | 2025-04-18 10:01:23 +0300 |
---|---|---|
committer | robot-piglet <[email protected]> | 2025-04-18 10:11:30 +0300 |
commit | 29fdf8a9f783e2c0606a9bd4a3af8f8fc9744c51 (patch) | |
tree | d49dc239da0da3011f724e57ef19b34eb0ab4105 /contrib/python/allure-python-commons/allure_commons | |
parent | a7a5bcf29159ffaaaeda629263134d5b43df082f (diff) |
Intermediate changes
commit_hash:f57d2c87e0eaaab821faa70c3864ec0e7320355d
Diffstat (limited to 'contrib/python/allure-python-commons/allure_commons')
5 files changed, 18 insertions, 8 deletions
diff --git a/contrib/python/allure-python-commons/allure_commons/_allure.py b/contrib/python/allure-python-commons/allure_commons/_allure.py index 05e01dbd4be..b7bbe2a5e07 100644 --- a/contrib/python/allure-python-commons/allure_commons/_allure.py +++ b/contrib/python/allure-python-commons/allure_commons/_allure.py @@ -1,5 +1,5 @@ from functools import wraps -from typing import Any, Callable, TypeVar +from typing import Any, Callable, TypeVar, Union, overload from allure_commons._core import plugin_manager from allure_commons.types import LabelType, LinkType, ParameterMode @@ -133,7 +133,7 @@ class Dynamic: plugin_manager.hook.add_link(url=url, link_type=link_type, name=name) @staticmethod - def parameter(name, value, excluded=None, mode: ParameterMode = None): + def parameter(name, value, excluded=None, mode: Union[ParameterMode, None] = None): plugin_manager.hook.add_parameter(name=name, value=value, excluded=excluded, mode=mode) @staticmethod @@ -161,6 +161,16 @@ class Dynamic: return Dynamic.label(LabelType.MANUAL, True) +@overload +def step(title: str) -> "StepContext": + ... + + +@overload +def step(title: _TFunc) -> _TFunc: + ... + + def step(title): if callable(title): return StepContext(title.__name__, {})(title) @@ -191,7 +201,7 @@ class StepContext: with StepContext(self.title.format(*args, **params), params): return func(*a, **kw) - return impl + return impl # type: ignore class Attach: diff --git a/contrib/python/allure-python-commons/allure_commons/logger.py b/contrib/python/allure-python-commons/allure_commons/logger.py index d0ac1e2491b..55f956f2507 100644 --- a/contrib/python/allure-python-commons/allure_commons/logger.py +++ b/contrib/python/allure-python-commons/allure_commons/logger.py @@ -15,7 +15,7 @@ class AllureFileLogger: def __init__(self, report_dir, clean=False): self._report_dir = Path(report_dir).absolute() if self._report_dir.is_dir() and clean: - shutil.rmtree(self._report_dir) + shutil.rmtree(self._report_dir, ignore_errors=True) self._report_dir.mkdir(parents=True, exist_ok=True) def _report_item(self, item): diff --git a/contrib/python/allure-python-commons/allure_commons/model2.py b/contrib/python/allure-python-commons/allure_commons/model2.py index e8fd330a0b0..ccaf4459d6a 100644 --- a/contrib/python/allure-python-commons/allure_commons/model2.py +++ b/contrib/python/allure-python-commons/allure_commons/model2.py @@ -53,7 +53,7 @@ class TestResult(ExecutableItem): @attrs class TestStepResult(ExecutableItem): - id = attrib(default=None) + id = attrib(default=None) # noqa: A003 @attrs @@ -82,7 +82,7 @@ class Label: @attrs class Link: - type = attrib(default=None) + type = attrib(default=None) # noqa: A003 url = attrib(default=None) name = attrib(default=None) @@ -99,7 +99,7 @@ class StatusDetails: class Attachment: name = attrib(default=None) source = attrib(default=None) - type = attrib(default=None) + type = attrib(default=None) # noqa: A003 class Status: diff --git a/contrib/python/allure-python-commons/allure_commons/py.typed b/contrib/python/allure-python-commons/allure_commons/py.typed new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/contrib/python/allure-python-commons/allure_commons/py.typed diff --git a/contrib/python/allure-python-commons/allure_commons/types.py b/contrib/python/allure-python-commons/allure_commons/types.py index 06b77dfa151..e631e427c60 100644 --- a/contrib/python/allure-python-commons/allure_commons/types.py +++ b/contrib/python/allure-python-commons/allure_commons/types.py @@ -53,7 +53,7 @@ class AttachmentType(Enum): PNG = ("image/png", "png") JPG = ("image/jpg", "jpg") - SVG = ("image/svg-xml", "svg") + SVG = ("image/svg+xml", "svg") GIF = ("image/gif", "gif") BMP = ("image/bmp", "bmp") TIFF = ("image/tiff", "tiff") |