Skip to content

Issue: mercurial / svn missing skips git tests #482

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tony
Copy link
Member

@tony tony commented Dec 24, 2024

Problem

If svn (subversion) or hg (mercurial) isn't installed, fixtures for git-based tests won't run.

Summary by Sourcery

Tests:

  • Skip tests for Mercurial, Subversion, and Git if the corresponding VCS command is not available.

Copy link

codecov bot commented Dec 24, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 54.01%. Comparing base (5ded894) to head (fb20670).

Files with missing lines Patch % Lines
src/libvcs/pytest_plugin.py 40.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #482      +/-   ##
==========================================
- Coverage   54.08%   54.01%   -0.07%     
==========================================
  Files          40       40              
  Lines        3635     3634       -1     
  Branches      793      794       +1     
==========================================
- Hits         1966     1963       -3     
- Misses       1318     1319       +1     
- Partials      351      352       +1     

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

@tony tony force-pushed the bin-installs-unused-fixtures branch from d78f84d to 6436c03 Compare December 24, 2024 22:25
@tony tony force-pushed the bin-installs-unused-fixtures branch from 6436c03 to 6927e42 Compare December 24, 2024 22:29
@tony tony force-pushed the bin-installs-unused-fixtures branch from 6927e42 to fb20670 Compare January 11, 2025 20:53
@tony
Copy link
Member Author

tony commented Jan 11, 2025

@sourcery-ai review

Copy link

sourcery-ai bot commented Jan 11, 2025

Reviewer's Guide by Sourcery

This pull request fixes an issue where tests were skipped if certain VCS binaries were missing, but the tests didn't rely on those binaries. The logic was unintentionally skipping tests that should have run. The fix now correctly skips tests only when the required VCS binary is missing.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Tests are now correctly skipped only when a required VCS binary is missing. Previously, tests were skipped if any of svn, git, or hg were missing, regardless of whether the test used them.
  • Modified the pytest_ignore_collect function to check if a VCS binary is missing and if the test path contains the name of the missing binary. This ensures that tests are skipped only when the required binary is actually missing.
  • Removed redundant boolean check at the end of the function, simplifying the logic.
src/libvcs/pytest_plugin.py
Removed an unnecessary fixture that set the Mercurial configuration.
  • Removed the set_hgconfig fixture, as it was not used in any of the tests and added unnecessary overhead.
tests/sync/test_hg.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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.

Hey @tony - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +117 to +121
if any( # NOQA: SIM103
needle in str(collection_path) for needle in ["hg", "mercurial"]
) and not shutil.which("hg"):
return True
return False
Copy link

Choose a reason for hiding this comment

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

issue (code-quality): We've found these issues:

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.

1 participant