-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporated pathlib.Path compatibility #99
Conversation
In this commit I have added input (and explicit output) compatibility between pymapdl-reader and the pathlib.Path class. All file path-input arguments should now be accepted as either strings or pathlib.Path objects. Additionally there is no breaing change regarding the filename properties. These will continue to return strings. Wherever possible I have made it so that internally we store paths as pathlib.Path objects and they are returned as strings through properties. Setters additionally will accept strings or pathlib.Path objects. Unfortunately i have not been able to get the test suite working on my local machine and so have not been able to write tests to go with these changes. I would appreciate input from others regarding how to get the tests running and if my changes do break any existing tests. I do not believe so but I am very limited in how I can check.
Let's open a separate PR to decouple the testing requirements of |
Changed the suffix comparison to include the leading '.' because pathlib.Path.suffix does include it. Made sure that AnsysFile converts any potential paths to string before they are passed as arguments. Additionally split thermal test up until multiple tests within a class to make it easier to read. All existing tests pass with pathlib changes.
Added additional tests to check the input and output is correct for the 4 classes that use pathlib.Path now.
Ready for review! |
def filename(self) -> str: | ||
"""String form of the filename. Accepts ``pathlib.Path`` and string objects when set.""" | ||
return str(self._filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with this for backwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Good work here.
In this PR I have added input (and explicit output) compatibility
between pymapdl-reader and the pathlib.Path class. All file path-input
arguments should now be accepted as either strings or pathlib.Path
objects. Additionally there is no breaking change regarding the filename
properties. These will continue to return strings. Wherever possible I
have made it so that internally we store paths as pathlib.Path objects
and they are returned as strings through properties. Setters
additionally will accept strings or pathlib.Path objects.
Users can access the pathlib.Path objects via new
pathlib_filename
properties.I could not think of a better name, but suggestions are welcome.
Unfortunately i have not been able to get the test suite working on mylocal machine and so have not been able to write tests to go with these
changes. I would appreciate input from others regarding how to get the
tests running and if my changes do break any existing tests. I do not
believe so but I am very limited in how I can check.
With the latest commits and #103 I have managed to get my development version
working and confirmed the changes work as well as adding tests for them.
This PR is ready for review and merging.
(closes #98)