Repository navigation
fix: select the newest file in last_created (migrated PR 4932) - #4967
Merged
Merged
Conversation
4 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4967 +/- ##
==========================================
- Coverage 91.94% 91.92% -0.03%
==========================================
Files 247 247
Lines 18545 18546 +1
==========================================
- Hits 17052 17049 -3
- Misses 1493 1497 +4 🚀 New features to boost your workflow:
|
germa89
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a mirror pull request created from fix: select the newest file in last_created to allow the code to access PyMAPDL CICD secrets.
Check the original PR made by @Tonylo-lab for more details.
Closes #4932
Original pull request
fix: select the newest file in last_created
Description
last_created()currently returns the last filename for every nonempty input, regardless of creation times.len(set(ctimes))is always nonzero for such inputs, so the already-computednp.argmaxresult is never used.Change this condition to
len(set(ctimes)) == 1. This selects the newest file when times differ while preserving the documented rule of returning the last filename when all creation times are equal.Add 10 parameterized/edge cases in
tests/test_misc.py: all six orders of three files with distinct times, three equal-time/single-file cases, and the existing empty-input error behavior.Issue linked
This addresses a locally reproduced defect on
mainat154828f; no new issue was opened. The helper is used by result-file selection, includingMapdlGrpc._distributed_result_file. With a newerfile0.rthand an olderfile0.rst, that getter currently chooses the older.rstfile.Validation
Tested on Windows, Python 3.12.15, PyMAPDL 0.74.dev0, pytest 9.1.1 and NumPy 2.5.4.
tests/test_misc.pygives 4 failed / 7 passed before the fix and 11 passed after it (40 unrelated cases deselected). This includes the existing real-file creation-time test._distributed_result_filegetter with a minimal local context and real files: it selects the older.rstbefore the fix and the newer.rthafterward. These are synthetic files, with no MAPDL connection or solver-generated contents.last_created()has 100% line and branch coverage (5 statements and 2 branches).git diff --checkpasses, and the final patch matches the reviewed draft exactly.Known baseline check failure: full
pre-commit run --all-filesstops atsrc/ansys/mapdl/core/errors.py:601:Module has no attribute "SIGKILL". Windows does not providesignal.SIGKILL. The same single error reproduces on unmodified154828f(325 source files checked); it is tracked separately in #4903 / #4904. This PR does not change that code.Not run: MAPDL live-server/solver tests or the full test suite. No MAPDL process was launched.
Checklist
Prepared and verified with assistance from Codex.