Skip to content

Commit

Permalink
dataclasses in parser.py should not be compared by their members, b…
Browse files Browse the repository at this point in the history
…ut only by just their identity.

This fixes an issue with python 3.13 (max recursion depth when running `ScenarioTemplate.__eq__`)
  • Loading branch information
youtux committed Mar 17, 2024
1 parent a76e2b3 commit 6170a45
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/pytest_bdd/parser.py
Expand Up @@ -202,7 +202,7 @@ def parse_feature(basedir: str, filename: str, encoding: str = "utf-8") -> Featu
return feature


@dataclass
@dataclass(eq=False)
class Feature:
scenarios: OrderedDict[str, ScenarioTemplate]
filename: str
Expand All @@ -214,7 +214,7 @@ class Feature:
description: str


@dataclass
@dataclass(eq=False)
class ScenarioTemplate:
"""A scenario template.
Expand Down Expand Up @@ -278,7 +278,7 @@ def description(self):
return "\n".join(self._description_lines)


@dataclass
@dataclass(eq=False)
class Scenario:
feature: Feature
name: str
Expand All @@ -288,7 +288,7 @@ class Scenario:
description: list[str] = field(default_factory=list)


@dataclass
@dataclass(eq=False)
class Step:
type: str
_name: str
Expand Down Expand Up @@ -365,7 +365,7 @@ def replacer(m: Match):
return STEP_PARAM_RE.sub(replacer, self.name)


@dataclass
@dataclass(eq=False)
class Background:
feature: Feature
line_number: int
Expand All @@ -377,7 +377,7 @@ def add_step(self, step: Step) -> None:
self.steps.append(step)


@dataclass
@dataclass(eq=False)
class Examples:
"""Example table."""

Expand Down

0 comments on commit 6170a45

Please sign in to comment.