Skip to content

Conversation

@germa89
Copy link
Collaborator

@germa89 germa89 commented Jun 16, 2025

Description

Recently we have seen some exceptions when trying to patch inexisting methods or attributes. This wasnt an issue before, but I guess something changed in #3987 or in #4005. I couldnt really figure out where. I guess it was in #3987.

Issue linked

NA

Checklist

Summary by Sourcery

Fix mock patching of ansys.tools.path.path version retrieval in tests to match renamed function.

Bug Fixes:

  • Replace deprecated _mapdl_version_from_path with _version_from_path in test decorators and fixtures.
  • Use side_effect for the patched _version_from_path call in the version error test for consistent behavior.

@germa89 germa89 requested a review from a team as a code owner June 16, 2025 09:02
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 16, 2025

Reviewer's Guide

This PR updates test patches to align with the renamed version extraction function in ansys.tools.path.path, replacing all references to the deprecated “_mapdl_version_from_path” with the new “_version_from_path” and introducing side_effect in one test to better simulate version errors.

File-Level Changes

Change Details Files
Refactor patch decorators to use the new version extraction function
  • Replaced all @patch targets from “_mapdl_version_from_path” to “_version_from_path”
  • Updated import paths in tests for consistency
  • Applied changes across both launcher and mapdl test modules
tests/test_launcher.py
tests/test_mapdl.py
Introduce side_effect in one version‐error test to simulate failures
  • Converted single-line patch to multi-line decorator
  • Switched lambda argument to side_effect parameter to raise version error
tests/test_launcher.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. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the 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 exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

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

@germa89
Copy link
Collaborator Author

germa89 commented Jun 16, 2025

@pyansys-ci-bot LGTM.

@germa89 germa89 enabled auto-merge (squash) June 16, 2025 09:02
Copy link
Contributor

@pyansys-ci-bot pyansys-ci-bot left a comment

Choose a reason for hiding this comment

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

✅ Approving this PR because germa89 said so in here 😬

LGTM

@github-actions github-actions bot added the bug Issue, problem or error in PyMAPDL label Jun 16, 2025
Copy link
Contributor

@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 @germa89 - I've reviewed your changes and they look great!


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.

@codecov
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.12%. Comparing base (4494edd) to head (ff77bb5).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4010      +/-   ##
==========================================
- Coverage   89.17%   89.12%   -0.05%     
==========================================
  Files         187      187              
  Lines       14970    14970              
==========================================
- Hits        13349    13342       -7     
- Misses       1621     1628       +7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@germa89 germa89 merged commit d723ed9 into main Jun 16, 2025
46 checks passed
@germa89 germa89 deleted the fix/mocking-unexisting-member branch June 16, 2025 09:39
@germa89 germa89 mentioned this pull request Jun 16, 2025
germa89 added a commit that referenced this pull request Jun 26, 2025
fix: path in testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue, problem or error in PyMAPDL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants