MSS icon indicating copy to clipboard operation
MSS copied to clipboard

fix: update abstract base class to include missing parameter

Open divyaajainn opened this issue 8 months ago • 7 comments

Purpose of PR?: Updates the abstract base class signature of _determine_filename to include a default reload parameter, aligning it with its implementations and usage in have_data.

Bug fix Fixes #2745

divyaajainn avatar Mar 31 '25 09:03 divyaajainn

see the 2nd task in the issue

ReimarBauer avatar Mar 31 '25 12:03 ReimarBauer

i will look into it today itself. i was busy with an event.

divyaajainn avatar Apr 02 '25 16:04 divyaajainn

Does this look good?

divyaajainn avatar Apr 09 '25 16:04 divyaajainn

I was going for that initially, but didn’t import pytest at the time so I just quickly checked the behavior with a try-except. I have updated it, does this look good?

divyaajainn avatar Apr 10 '25 07:04 divyaajainn

I think the error is caused when I clear _filetree (by setting it to {}), the expected ValueError isn’t raised maybe DUT’s setup or a caching mechanism might be preventing it from being empty. i am thinking of adding an assertion to verify the internal state before calling _determine_filename and use debug logging to see if the except clause is reached. That way if the implementation needs to be adjusted.

divyaajainn avatar Apr 13 '25 07:04 divyaajainn

I think the error is caused when I clear _filetree (by setting it to {}), the expected ValueError isn’t raised maybe DUT’s setup or a caching mechanism might be preventing it from being empty.

The test failure you are seeing is not caused by the first with pytest.raises(ValueError):, but by the second one. Congratulations, you have found a new bug: _determine_filename returns an invalid/outdated filename with reload=True because it blindly trusts the cached filenames in _filetree. @ReimarBauer I think this needs some clarification on how this method is supposed to work, the reload parameter suggests there have been performance concerns in the past that prevented an implementation that tries to always be consistent with the filesystem?

In an attempted fix of this bug I noticed that just appending .bak to a filename in the test is not enough, as the next call to .setup will then pick up the variable from the .bak file.

matrss avatar Apr 22 '25 08:04 matrss

Thanks. I hadn’t realized the failure was from the second ValueError. I’ll hold off on changes for now and wait for clarification on the expected behavior of reload. I’ll also update the test to avoid .bak files being picked up by .setup.

divyaajainn avatar Apr 25 '25 06:04 divyaajainn