diff --git a/docs/source/changes.rst b/docs/source/changes.rst index 87ae9a75..169b26b6 100644 --- a/docs/source/changes.rst +++ b/docs/source/changes.rst @@ -12,6 +12,7 @@ all releases are available on `PyPI `_ and - :gh:`217` enhances the tutorial on how to set up a project. - :gh:`218` removes ``depends_on`` and ``produces`` from the task function when parsed. +- :gh:`219` removes some leftovers from pytest in :class:`~_pytask.mark.Mark`. 0.1.8 - 2022-02-07 diff --git a/src/_pytask/mark/structures.py b/src/_pytask/mark/structures.py index b1d5a0c9..d963418d 100644 --- a/src/_pytask/mark/structures.py +++ b/src/_pytask/mark/structures.py @@ -5,9 +5,6 @@ from typing import Callable from typing import Iterable from typing import Mapping -from typing import Optional -from typing import Sequence -from typing import Tuple import attr @@ -16,25 +13,15 @@ def is_task_function(func: Any) -> bool: return callable(func) and getattr(func, "__name__", "") != "" -@attr.s(frozen=True) +@attr.s(frozen=True, auto_attribs=True) class Mark: - name = attr.ib(type=str) + name: str """str: Name of the mark.""" - args = attr.ib(type=Tuple[Any, ...]) + args: tuple[Any, ...] """Tuple[Any]: Positional arguments of the mark decorator.""" - kwargs = attr.ib(type=Mapping[str, Any]) + kwargs: Mapping[str, Any] """Mapping[str, Any]: Keyword arguments of the mark decorator.""" - _param_ids_from = attr.ib(type=Optional["Mark"], default=None, repr=False) - """Optional[Mark]: Source Mark for ids with parametrize Marks.""" - _param_ids_generated = attr.ib( - type=Optional[Sequence[str]], default=None, repr=False - ) - """Optional[Sequence[str]]: Resolved/generated ids with parametrize Marks.""" - - def _has_param_ids(self) -> bool: - return "ids" in self.kwargs or len(self.args) >= 4 - def combined_with(self, other: Mark) -> Mark: """Return a new Mark which is a combination of this Mark and another Mark. @@ -53,19 +40,10 @@ def combined_with(self, other: Mark) -> Mark: """ assert self.name == other.name - # Remember source of ids with parametrize Marks. - param_ids_from: Mark | None = None - if self.name == "parametrize": - if other._has_param_ids(): - param_ids_from = other - elif self._has_param_ids(): - param_ids_from = self - return Mark( self.name, self.args + other.args, - dict(self.kwargs, **other.kwargs), - param_ids_from=param_ids_from, + {**self.kwargs, **other.kwargs}, )