ansys / pyaedt

AEDT Python Client Package
https://aedt.docs.pyansys.com
MIT License
185 stars 101 forks source link

FIX: Design's save_project fails to save project when file_name's parent dir does not exist #4857

Closed alexciurana closed 5 days ago

alexciurana commented 1 week ago

Fixed a bug in Design.save_project() where the parent directory of file_name was created but the project was not saved. Added a test to verify the fix.

Additionally, modified the method to account for scenarios where remote_rpc_session is enabled, utilizing its file manager for path operations.

ansys-reviewer-bot[bot] commented 1 week ago

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

@ansys-reviewer-bot review

alexciurana commented 6 days ago

Not sure if we should add the create_parent_dir argument. Saying that, adding a check to create the directory should be the default approach in my opinion (like you just did) What about restricting the changes to modifying elif file_name into if file_name like you did ?

Of course, if there is a use case that I'm not thinking of where one could want to use create_parent_dir=False, then you can ignore this comment.

Modified the PR to remove that option and instead use remote_rpc_session and remote_rpc_session.filemanager methods to handling the path operations when working remotely, as it's done in other parts of the same file.

SMoraisAnsys commented 6 days ago

Did you run the tests locally ? I'll rerun the tests but there seem to be something failing.

alexciurana commented 5 days ago

Did you run the tests locally ? I'll rerun the tests but there seem to be something failing.

Yes. For example, for the file that I modified:

❯ pytest -n 1 .\_unittest\test_01_Design.py
59 passed, 1 warning in 51.05s 
SMoraisAnsys commented 5 days ago

Closing this in favor of #4868 to avoid secret issues.