Skip to content

Ensure proper close after open in export_od #469

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

Merged
merged 3 commits into from
Jun 30, 2024

Conversation

sveinse
Copy link
Collaborator

@sveinse sveinse commented Jun 20, 2024

This PR increases the robustness on file open in export_od(). It ensures that if the function opens a file, it will close it.

PS! The buried import is itching to be fixed, but let's not do that in this PR, please.

@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.

Project coverage is 67.55%. Comparing base (e40d862) to head (4364d89).
Report is 1 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #469      +/-   ##
==========================================
+ Coverage   67.21%   67.55%   +0.34%     
==========================================
  Files          26       26              
  Lines        3096     3098       +2     
  Branches      522      521       -1     
==========================================
+ Hits         2081     2093      +12     
+ Misses        873      864       -9     
+ Partials      142      141       -1     
Files Coverage Δ
canopen/objectdictionary/__init__.py 81.45% <90.47%> (+3.45%) ⬆️

@acolomb acolomb merged commit 5db5913 into canopen-python:master Jun 30, 2024
1 check passed
Comment on lines +52 to +53
else:
raise NotImplementedError(f"No support for the {doc_type!r} format")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I noticed this a little bit too late... this is a little bit unconventional; NotImplementedError is not meant for such use. IMO, ObjectDictionaryError would be more appropriate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Agreed. It's not always easy to "just fix" something like the close issue and then uncovering other things that needs fixing too. ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, one fix quickly leads to the discovery of other issues :) I'll create an issue about this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created #475.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record; before this PR, this check was an assert (IOW, AssertionError, unless running with -O or -OO).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants