-
Notifications
You must be signed in to change notification settings - Fork 192
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
Fix bug in Code.get_full_text_info
#4083
Fix bug in Code.get_full_text_info
#4083
Conversation
def1516
to
81289fe
Compare
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.
Thanks! I think it all should be good. I only made one specific comment and now two general question:
(1) Why a list of lists? I mean, I understand we don't want to change the interface now, but is there another reason no to have used a dictionary (since this list of lists seems like a "hacked" dict) or even a list of tupples (since this return being info on the node should perhaps not have mutable "info-pieces")?
(2) This was not just the get_full_text_info
method that was not being tested, but nothing from the code class correct? Then maybe it could be good to open an issue to discuss what other tests should be making for it?
This is indeed a remnant of old (sub-ideal) design. In old versions of AiiDA, the ORM classes also included many methods to do a lot of formatting of information such that it is easier, for example, for CLI commands to call them. I think this is not a good design as the formatting of data is not the task of an ORM class but exactly that of a CLI. I have been removing a lot of them, or at the very least, return them in a form where they can still be manipulated somewhat for formatting (i.e. do not return a preformatted string). I totally agree that this current form also makes little sense, so maybe we can deprecate this and remove it for
Yes, please go ahead |
37e18bd
to
ff9b2dd
Compare
Ok this is super annoying: the test failed for Py3.5, but I fixed it and pushed the changes. The change shows up here on the PR changes:
But on GHA, the test still fails and it still seems to be running the old code:
@greschd do you maybe have an idea? Is GHA caching the code? I think I have force pushed very often to fix open PRs and it has never been a problem. |
Wow, that's a curious one - I doubt GHA is intentionally caching the code, that would be a curious choice to lay the least. But looking at the log, it indeed showed
which is (see 7dbd51a) the merge-commit of Maybe there's an internal API somewhere that should tell GHA which commit this PR points to and failed. I've noticed minor glitches on GitHub quite frequently the last few weeks. How about you make an insignificant edit and force-push again? |
ff9b2dd
to
794e8a4
Compare
Seems like GHA picked the right commit this time around 🎉 |
Except turns out my "fix" was worth exactly nothing 😅 |
794e8a4
to
347f3e7
Compare
tests/orm/data/test_code.py
Outdated
|
||
# Cast `tmpdir` to str as it is a Path object and Python 3.5 does not support Path objects for `join` yet | ||
dirpath = str(tmpdir) | ||
filepath = os.path.join(dirpath, 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.
You could also cast to str
here, and use the glorious /
operator for joining:
filepath = str(dirpath / 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.
nice! It is clear I have not yet worked with Path
s at all. Was going to merge because I am sick of waiting for the builds of this PR, but this is too nice to pass on
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.
But, then I don't even need the cast right? Or does open
also not support Path
in 3.5?
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.
You still need the cast, pathlib
support across the board only came in 3.6.
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.
I guess we're back to waiting for another build 😅
Codecov Report
@@ Coverage Diff @@
## develop #4083 +/- ##
===========================================
+ Coverage 78.77% 78.80% +0.03%
===========================================
Files 463 463
Lines 34414 34414
===========================================
+ Hits 27106 27116 +10
+ Misses 7308 7298 -10
Continue to review full report at Codecov.
|
347f3e7
to
c31c235
Compare
This method was not tested and so it went unnoticed that it was still using the `_get_folder_pathsubfolder` repository method that has been removed in `aiida-core==1.0.0`. Direct access to the folder underlying the node repository is no longer allowed and instead the API should be used to inspect the available objects, in this case `list_objects`.
c31c235
to
fa608e9
Compare
I guess that's a no ... |
Fixes #4079
This method was not tested and so it went unnoticed that it was still
using the
_get_folder_pathsubfolder
repository method that has beenremoved in
aiida-core==1.0.0
. Direct access to the folder underlyingthe node repository is no longer allowed and instead the API should be
used to inspect the available objects, in this case
list_objects
.