Skip to content

Commit 6170a45

Browse files
committed
dataclasses in parser.py should not be compared by their members, but only by just their identity.
This fixes an issue with python 3.13 (max recursion depth when running `ScenarioTemplate.__eq__`)
1 parent a76e2b3 commit 6170a45

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/pytest_bdd/parser.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def parse_feature(basedir: str, filename: str, encoding: str = "utf-8") -> Featu
202202
return feature
203203

204204

205-
@dataclass
205+
@dataclass(eq=False)
206206
class Feature:
207207
scenarios: OrderedDict[str, ScenarioTemplate]
208208
filename: str
@@ -214,7 +214,7 @@ class Feature:
214214
description: str
215215

216216

217-
@dataclass
217+
@dataclass(eq=False)
218218
class ScenarioTemplate:
219219
"""A scenario template.
220220
@@ -278,7 +278,7 @@ def description(self):
278278
return "\n".join(self._description_lines)
279279

280280

281-
@dataclass
281+
@dataclass(eq=False)
282282
class Scenario:
283283
feature: Feature
284284
name: str
@@ -288,7 +288,7 @@ class Scenario:
288288
description: list[str] = field(default_factory=list)
289289

290290

291-
@dataclass
291+
@dataclass(eq=False)
292292
class Step:
293293
type: str
294294
_name: str
@@ -365,7 +365,7 @@ def replacer(m: Match):
365365
return STEP_PARAM_RE.sub(replacer, self.name)
366366

367367

368-
@dataclass
368+
@dataclass(eq=False)
369369
class Background:
370370
feature: Feature
371371
line_number: int
@@ -377,7 +377,7 @@ def add_step(self, step: Step) -> None:
377377
self.steps.append(step)
378378

379379

380-
@dataclass
380+
@dataclass(eq=False)
381381
class Examples:
382382
"""Example table."""
383383

0 commit comments

Comments
 (0)