-
Notifications
You must be signed in to change notification settings - Fork 31
[test][rfct] propagate pytest #779
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
Conversation
There's different conditions here that are relevant for
With And for
With Without Would separating these aspects of concerns into different (and less generically named) kwargs help? |
If there's a fight on two fronts behind the scenes, I guess this can be reflected by a attenzione:just proposing returned tuple of two numbers, where the first counts deleted Metadata-structures an the 2nd counts deleted physical files - both should match in an ideal world. The use case with the half-life files because of a broken removal and therefore missing or ghost items sounds very reasonable. When processing large batches in automated fashion, this is a rather familiar scenario. Instead of modifying the API, I prefer to return more meaningful responses. |
To clear out my latest comment about the parameter It checks if a) the METS itself matches the provided condition and if b) there are some physical files that would be affected. That's two different things. Now I propose, instead of returning Having a file
This reflects all 4 behaviors which can be checked/tested independently. If you follow me, I would adjust the implementations from the remove-calls this way. And since you did not differentiate this before, it wouldn't affect existing client-code. |
This holds for removals of complete |
I am still not 100% sure wether I understand how conditions 2) and 4) might arise - if a file is not referenced in the metadata, it will never be deleted. We don't delete files not related to the workspace, at least we should not. But you seem to have a clear idea on how you'd go about implementing it and having a more expressive return value instead of a void method is indeed backwards-compatible, so by all means, go ahead, it probably becomes clearer with a (proof-of-concept) implementation 👍 |
You're right concerning this, maybe these scenarios are somewhat too academical. I looked again at To get on with the overall topic of just transforming the tests, I've updated the PR from recent master and I guess we should get along with that before this freezes again. |
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.
🎉 Great work! Let's just make sure that all asserts are actually asserting and it runs in Python 3.7.
Here are some more refactorings for both
test_ocrd_page
andtest_workspace
modules.The major challenge was to get where paths-n-files actually are located, which is a quite hard for someone not familiar with the
pushd_popd
functionalities. Further, I divided test cases where beside regular assertions also exceptions were risen to have the exception handling being placed in it's own, separate test case.One point that still puzzles me is the behavior of the
ocrd_workspace
remove_...
- calls with theforce
parameter for invalid data (i.e., data which doesn't exist at all). I know we had already discussions about this, but still, I don't get it, since one might check the returned value from these calls, which in will result into 'None' for invalid data but are considered success.Please take into account all the
TODO
marks I've placed. They can be dropped if the reasons clear out.