aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

`orm/utils/node.py`: Bug fix, `removeprefix` was being applied to `'data'` instead of `'process'`

Open Muhammad-Rebaal opened this issue 10 months ago • 14 comments

Description: There was an issue in the line 64 that removeprefix function was being applied to data. instead of process.

In the end the change made here doesn't change any behaviour, it simply remove a line of code that was not doing anything useful.

Reference Link to PR #6758

Muhammad-Rebaal avatar Feb 16 '25 06:02 Muhammad-Rebaal

It is an empty PR, could you check you push the change?

unkcpz avatar Feb 16 '25 09:02 unkcpz

It is an empty PR, could you check you push the change?

I've Updated

Muhammad-Rebaal avatar Feb 16 '25 11:02 Muhammad-Rebaal

Added the functional change #6758

If it's possible please give more detailed explanation.

Also the title: "Deprecated function" is not descriptive at all, please revise.

khsrali avatar Feb 17 '25 08:02 khsrali

@Muhammad-Rebaal thank you for the PR, see my review comments.

We need to add tests covering this code. Can you please try to add them to tests/orm/utils/test_node.py. You should be able to run the tests locally by

pytest tests/orm/utils/test_node.py

Let us know if you need asssistance with them:

Yeah sure @danielhollas ! But if you describe what is your intention by adding a test in that particular file about those functions that've changed then it would be easier for me to implement that.

Muhammad-Rebaal avatar Feb 17 '25 14:02 Muhammad-Rebaal

Added the functional change #6758

If it's possible please give more detailed explanation.

Also the title: "Deprecated function" is not descriptive at all, please revise.

I've changed that and thank you for your assistance .

Muhammad-Rebaal avatar Feb 17 '25 14:02 Muhammad-Rebaal

Hi @Muhammad-Rebaal, please check the comment above, there are diff compares in the code not cleaned.

unkcpz avatar Feb 17 '25 22:02 unkcpz

Hi @Muhammad-Rebaal, please check the comment above, there are diff compares in the code not cleaned.

Hi @unkcpz @danielhollas ! Yes , I've updated the suggested change in src/aiida/orm/utils/node.py file which is in line 62 and 63.

Muhammad-Rebaal avatar Feb 18 '25 15:02 Muhammad-Rebaal

Hey @danielhollas @unkcpz ! Need some assistance regarding the test part . By running this command : pytest tests/orm/utils/test_node.py I ran into some issues like :

E :PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\Temp\\AppData\\Local\\Temp\\pytest-of-Temp\\pytest-22\\28efecaa984d0d6c847fc2b33421ae0c0\\.aiida\\tmpgopjmudt' -> 'C:\\Users\\Temp\\AppData\\Local\\Temp\\pytest-of-Temp\\pytest-22\\28efecaa984d0d6c847fc2b33421ae0c0\\.aiida\\config.json'

C:\Users\Temp\AppData\Roaming\Python\Python312\site-packages\aiida\manage\configuration\config.py:782: PermissionError
========================= slowest 50 durations ========================= 

(2 durations < 1s hidden.  Use -vv to show these durations.)
======================= short test summary info ======================== 
ERROR tests/orm/utils/test_node.py::test_load_node_class_fallback - PermissionError: [WinError 32] The process cannot access the file be...  

If you know how to resolve this please let me know . I've done the previous parts of removing the conflict and adding the suggested changes .

Muhammad-Rebaal avatar Feb 22 '25 18:02 Muhammad-Rebaal

I am not a Windows user, but it looks like perhaps you have the file opened in an editor or somewhere else and pytest cannot access it?

danielhollas avatar Feb 22 '25 19:02 danielhollas

Hey @danielhollas @unkcpz ! I've added the tests in the tests/orm/utils/test_node.py directory and implemented the tests and they are passed as well , here's the picture :

image

And a little request if you could assign me those issues that I've resolved #6760 , #6758 , #6705 as a token of appreciation for my contributions.

Muhammad-Rebaal avatar Feb 23 '25 16:02 Muhammad-Rebaal

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 78.32%. Comparing base (660fec7) to head (83833ec). :warning: Report is 132 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6760      +/-   ##
==========================================
+ Coverage   78.31%   78.32%   +0.02%     
==========================================
  Files         566      566              
  Lines       42762    42767       +5     
==========================================
+ Hits        33484    33495      +11     
+ Misses       9278     9272       -6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Mar 04 '25 19:03 codecov[bot]

Hey @danielhollas ! Hope you are fine !

Is this issue resolved ? Or needs to have some work ? Please let me know ?

Thank You !

Muhammad-Rebaal avatar Mar 24 '25 10:03 Muhammad-Rebaal

@Muhammad-Rebaal thanks for the ping! Regarding the changes themselves, I just have some minor cleanup notes.

It would be great if we could get 100% test coverage for the orm/utils/node.py file in this PR, since you've added a bunch of tests already. If you're up for it, you can check which branches are not tested on Codecov report here: https://app.codecov.io/gh/aiidateam/aiida-core/pull/6760/blob/src/aiida/orm/utils/node.py

image

There's actually not much missing!

Yeah sure ! It would be a pleasure to do that .

Muhammad-Rebaal avatar Mar 25 '25 20:03 Muhammad-Rebaal

Hi @danielhollas , @unkcpz !

Hope you are fine !

Could you please review code . I've added the 100% test coverage for node.py in test_node.py . I've also tested it locally by coverage a python library.

Thank You !

Muhammad-Rebaal avatar Mar 27 '25 11:03 Muhammad-Rebaal

I opened a new PR #6983 based on this one since I didn't want to push changes here.

danielhollas avatar Aug 21 '25 09:08 danielhollas

Closing this in favor of #6983. Please continue development there.

GeigerJ2 avatar Aug 22 '25 13:08 GeigerJ2