Skip to content
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

Fix parsers.re doing only partial string match #539

Merged
merged 3 commits into from
Jul 15, 2022
Merged

Fix parsers.re doing only partial string match #539

merged 3 commits into from
Jul 15, 2022

Conversation

youtux
Copy link
Contributor

@youtux youtux commented Jul 12, 2022

This PR make sure that parsers.re does a fullmatch of the re, rather than ignoring non-matching characters at the end of the string.
All the other parsers already work this way, there is no reason for parsers.re not to.

Checklist

This makes it work the same way other parsers work (they don't ignore non-matching characters at the end of the string)
@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #539 (fc6333a) into master (e24aee0) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #539      +/-   ##
==========================================
+ Coverage   92.43%   92.46%   +0.02%     
==========================================
  Files          49       49              
  Lines        1679     1685       +6     
  Branches      208      208              
==========================================
+ Hits         1552     1558       +6     
  Misses         90       90              
  Partials       37       37              
Impacted Files Coverage Δ
pytest_bdd/parsers.py 85.96% <100.00%> (ø)
tests/args/regex/test_args.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e24aee0...fc6333a. Read the comment docs.

@youtux youtux merged commit adcc48f into master Jul 15, 2022
@youtux youtux deleted the re-fullmatch branch July 15, 2022 16:38
The-Compiler added a commit to qutebrowser/qutebrowser that referenced this pull request Jul 17, 2022
@The-Compiler
Copy link
Member

FWIW this broke a couple of tests for me where I used trailing periods: qutebrowser/qutebrowser@418f91d

Is that intended? I'm guessing yes, but I have no idea how other Gherkin parsers handle this.

@youtux
Copy link
Contributor Author

youtux commented Jul 17, 2022

It is expected to break a few steps indeed, I will release a new major version for this.

maybe I’ll mention in the release notes how to migrate to this, although I assume that if you use regex, you know how to consume all characters at the end of the string.

pbarnajc pushed a commit to pbarnajc/pytest-bdd that referenced this pull request Jan 31, 2023
Fix `parsers.re` doing only partial string match
pbarnajc pushed a commit to pbarnajc/pytest-bdd that referenced this pull request Feb 1, 2023
Fix `parsers.re` doing only partial string match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants