-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Exception inside contextmanager should cancel the zim creation #42
Comments
Yes. However, there is no proper way to cancel the zim creation on libzim side itself. I've just open a issue on libzim side : openzim/libzim#347 |
@mgautierfr, I tested the def test_creator_exception_item(fpath):
class AContentProvider:
def get_size(self):
return 1
def feed(self):
raise FileNotFoundError("missing file")
class AnItemWithCP(StaticItem):
def get_contentprovider(self):
return AContentProvider()
with Creator(fpath) as c:
with pytest.raises(RuntimeError, match="FileNotFoundError"):
c.add_item(AnItemWithCP()) It crashes with an output similar to:
What's different though is that a lot of the tests are now failing with the obscure |
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions. |
When using the context-manager, should a (non libzim) error occur, the exception is raised but the finalization is done on the Creator as if everything went well.
This results in a valid ZIM file on the filesystem but lacking the second article of course.
I think the expected behavior would be to cancel the ZIM creation and remove temporary files.
@mgautierfr @kelson42 ?
The text was updated successfully, but these errors were encountered: