pytest-dev / pytest-bdd

BDD library for the pytest runner
https://pytest-bdd.readthedocs.io/en/latest/
MIT License
1.32k stars 221 forks source link

Do not strip comments from step names #722

Closed youtux closed 1 month ago

youtux commented 1 month ago

Otherwise we wouldn't be gherkin compliant

youtux commented 1 month ago

@jsa34 mind reviewing this?

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.62%. Comparing base (3402450) to head (43d062b). Report is 9 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #722 +/- ## ========================================== - Coverage 95.63% 95.62% -0.02% ========================================== Files 55 55 Lines 2086 2081 -5 Branches 232 231 -1 ========================================== - Hits 1995 1990 -5 Misses 55 55 Partials 36 36 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

youtux commented 1 month ago
  1. Maybe a test to ensure # and trailing text don't get stripped?

It's already tested in test_scenario_comments, but I will add testing for the step and and scenario names. Done in 48e51caf

  1. There is a strict gherkin flag and tests - can we get rid of these now as we are always strict gherkin?

I'll check that and open another PR.

  1. I haven't checked, but are there other places the old parser stripped comments in this way (such as example table entries)? If so, perhaps the change log should reflect that not just comments in steps will no longer be stripped.

It doesn't look like so. Anyway I updated the CHANGES.rst to mention that now also Scenario and Feature names won't be stripped for comments (43d062b3)