-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Gherkin local dataclasses #759
base: master
Are you sure you want to change the base?
Conversation
…n pytest-bdd. Bump the minimum supported version of gherkin-official to v30 to support this and remove the warnings in python 3.13+
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #759 +/- ##
==========================================
- Coverage 96.05% 95.34% -0.71%
==========================================
Files 55 53 -2
Lines 2359 2193 -166
Branches 136 157 +21
==========================================
- Hits 2266 2091 -175
- Misses 56 60 +4
- Partials 37 42 +5 ☔ View full report in Codecov by Sentry. |
def _to_raw_string(normal_string: str) -> str: | ||
return normal_string.replace("\\", "\\\\") | ||
def replace_datatable_values(document: GherkinDocument) -> None: | ||
"""Replace all cell values in DataTables within a GherkinDocument using _to_raw_string.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary? Maybe it should be done by gherkin-official
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, I'd rather avoid trying to patch datatables here at all, and instead handle it in src/pytest_bdd/scenario.py
, since it's one place there, but many places here
yield self.parse_scenario(child.scenario, feature, rule) | ||
for child in rule_data["children"]: | ||
if "scenario" in child: | ||
yield self.parse_scenario(child["scenario"], feature, rule) # type: ignore[typeddict-item] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should try avoiding # type: ignore
. What's the issue here? Maybe we need to cast child
to a specific type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we keep testing the error messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should change gherkin-official
to return classes instead of dicts now. WDYT?
Good point - ideally, I guess it should return the gherkin messages format (which will be dataclasses) so should wait to do this until that is resolved. I'll mark this as draft until then but you have rightly pointed out workarounds that should probably also be backported to gherkin-official. |
Remove the custom definition of the gherkin document as dataclasses in pytest-bdd.
Bump the minimum supported version of gherkin-official to v30 to support this and remove the warnings in python 3.13+