Skip to content

Conversation

@germa89
Copy link
Collaborator

@germa89 germa89 commented Jun 10, 2025

Description

Fix not running xsel commands in non_interactive.

Issue linked

Close #3989

Checklist

Summary by Sourcery

Fix selection commands not executing in non-interactive mode and update related tests.

Bug Fixes:

  • Ensure inner_wrapper invokes selection functions in non-interactive sessions instead of returning early.

Tests:

  • Rename multiline failure tests to distinguish between ValueError and DeprecationWarning.
  • Add parameterized tests for node selection (nsel) behavior under non-interactive context for different selection types.

@germa89 germa89 requested a review from a team as a code owner June 10, 2025 08:50
@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 10, 2025

Reviewer's Guide

Restore command execution in non-interactive mode by modifying the inner_wrapper early return to call the wrapped function, and improve test coverage by renaming existing tests for clarity and adding a parameterized test for node selection under non-interactive conditions.

File-Level Changes

Change Details Files
Execute commands in non-interactive mode by calling the wrapped function instead of returning early
  • Replaced silent return with return func(*args, **kwargs) when self._store_commands is True
  • Ensures xsel (selection) commands run under non-interactive context
src/ansys/mapdl/core/mapdl_core.py
Refine and extend tests for multiline input and non-interactive selection
  • Renamed test_multiline_fail to test_multiline_fail_value_error to reflect ValueError expectation
  • Renamed second test_multiline_fail to test_multiline_fail_deprecation_warning to capture deprecation warning
  • Added test_selection_on_non_interactive parameterized over selection types (S,R,U,A) to validate node selection behavior under non-interactive mode
tests/test_mapdl.py

Assessment against linked issues

Issue Objective Addressed Explanation
#3989 Fix the issue where selection commands (like nsel) do not work correctly within the non_interactive context.

Possibly linked issues


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

@github-actions github-actions bot added the bug Issue, problem or error in PyMAPDL label Jun 10, 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 - here's some feedback:

  • Consider renaming _store_commands to something like _non_interactive_mode or _deferred_execution to better reflect its purpose and improve readability.
  • Add analogous tests for other selection methods (e.g. esel, csel) to ensure this non‐interactive execution fix applies consistently across all *_sel commands.
  • Ensure the non_interactive context manager fully restores the original interactive state on exit so that selection state doesn’t leak into subsequent operations.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: 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.

@codecov
Copy link

codecov bot commented Jun 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.12%. Comparing base (44e4dee) to head (7830b78).
Report is 2 commits behind head on main.

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

@germa89 germa89 changed the title Fix/selection-on-non-interactive fix: selection on non-interactive Jun 10, 2025
@germa89 germa89 self-assigned this Jun 10, 2025
@germa89
Copy link
Collaborator Author

germa89 commented Jun 10, 2025

@pyansys-ci-bot LGTM.

@germa89 germa89 enabled auto-merge (squash) June 10, 2025 09:27
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

@germa89 germa89 merged commit 4494edd into main Jun 10, 2025
46 checks passed
@germa89 germa89 deleted the fix/selection-on-non-interactive branch June 10, 2025 10:02
germa89 added a commit that referenced this pull request Aug 4, 2025
* fix: ensure command execution in interactive mode when storing commands

* test: add parameterized test for selection on non-interactive mode

* chore: adding changelog file 3998.miscellaneous.md [dependabot-skip]

* refactor: clarify non-interactive mode behavior in command execution and simplify selection condition in tests

* test: parameterize selection tests for non-interactive mode

* test: refactor selection tests for non-interactive mode into a class-based structure

---------

Co-authored-by: pyansys-ci-bot <[email protected]>
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.

Selection doesn't work in non_interactive

3 participants