libvcs icon indicating copy to clipboard operation
libvcs copied to clipboard

Issue: `mercurial` / `svn` missing skips git tests

Open tony opened this issue 11 months ago • 3 comments

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.

tony avatar Dec 24 '24 22:12 tony

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 :warning:
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     

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

codecov[bot] avatar Dec 24 '24 22:12 codecov[bot]

@sourcery-ai review

tony avatar Jan 11 '25 20:01 tony

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

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar Jan 11 '25 20:01 sourcery-ai[bot]