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 pytest version check #669

Merged
merged 1 commit into from
Feb 24, 2024
Merged

Fix pytest version check #669

merged 1 commit into from
Feb 24, 2024

Conversation

youtux
Copy link
Contributor

@youtux youtux commented Jan 21, 2024

No description provided.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Type: Refactoring

PR Summary: The pull request updates the version checking logic in the pytest_bdd compatibility module to use a more efficient tuple comparison rather than creating a new Version object.

Decision: Comment

📝 Type: 'Refactoring' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
✅ Small diff: the diff is small enough to approve with confidence.
No details provided.

General suggestions:

  • Confirm that the release attribute of the parse_version object will consistently provide a tuple for comparison and will not result in any AttributeError or TypeError.
  • Consider whether patch versions of pytest could affect the compatibility and if so, ensure that the version checking logic accounts for this.
  • Review the broader impact of this change to ensure that it aligns with compatibility requirements across different pytest versions.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Copy link

codecov bot commented Jan 21, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (5581e77) 95.18% compared to head (32031da) 95.17%.

Files Patch % Lines
src/pytest_bdd/compat.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #669      +/-   ##
==========================================
- Coverage   95.18%   95.17%   -0.01%     
==========================================
  Files          50       50              
  Lines        1826     1825       -1     
  Branches      200      200              
==========================================
- Hits         1738     1737       -1     
  Misses         57       57              
  Partials       31       31              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@The-Compiler The-Compiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the radio silence - this seems to fix things from what I can see!

If you'd be willing to lift the minimum pytest version to 7 (released almost two years ago), you could also use pytest.version_tuple instead. That'd mean not introducing the new dependency on packaging.

Or given that you're only interested in major/minor version, you'd probably get away with tuple(int(c) for c in pytest.__version__.split(".")[:2]) on pytest 6.x (oh, the irony of having a version-dependent version check...).

@youtux youtux merged commit 072c899 into master Feb 24, 2024
11 of 13 checks passed
@youtux youtux deleted the ab/fix-pytest-version-check branch February 24, 2024 12:04
@youtux
Copy link
Contributor Author

youtux commented Feb 24, 2024

yes I could update to pytest 7, but I don't have much time so I'll just merge this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants