-
Notifications
You must be signed in to change notification settings - Fork 43
introduced option to specify file encoding #284
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
pllim
left a comment
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.
Thanks!
More eyes on review would be good. The diff looks reasonable to me.
|
|
||
|
|
||
| def write_modified_file(fname, new_fname, changes): | ||
| def write_modified_file(fname, new_fname, changes, encoding=None): |
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.
Should the default here be consistent with addoption default (utf-8)?
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.
Yes, it should be consistent, though I'm not sure if we should change the default to utf-8 or leave as is now?
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.
I decided to set encoding=None to avoid changing the behavior of the write_modified_file function since I am not familiar with your codebase. I wanted to ensure that the function behaves as it did before.
From a developer's perspective, I would prefer using "utf-8" as the default encoding.
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.
any changes required?
i guess the default value of write_modified_file is uncritical.
default value for cli option defaults to "utf-8" which will be passed on.
|
@pllim - bugfix or enhancement? |
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.
Thank you! The diff looks good to me. However, this will definitely need a test, the one in the bug report issue would be great. And will eventually need an entry in the changelog, though we need to agree on if this is a feature or a bugfix first.
Hmm... It does introduce a new option, so more like enhancement? |
|
i tried to implement some tests but seems with with see commit f91f597 |
|
changed PR to Draft todos
|
|
@d-chris - the last todo point should definitely not be mixed into this PR |
|
for testing implemented alternative fixture to generate temporary python files, due issue #285 |
|
somehow a can't trigger action within my fork, any tips? i created a new action (outside of the PR scope) -> pass https://github.com/d-chris/pytest-doctestplus/actions/runs/14041267921 so the small fix from 09979a3 solved the issue |
d-chris
left a comment
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.
fixed in 09979a3
|
Github Actions has to be enabled explicitly by maintainer if it detects a first time contributor. It is how they attempt to prevent bitcoin miners. Nothing you could have done on your side. I just enabled the CI. Thanks for your patience! |
|
Thanks for your patience—this is my first GH contribution ever! Is there anything else I need to do to finish the PR? |
|
Since @bsipocz requested changes, would be nice if she could re-review. 🙏 |
|
|
||
|
|
||
| def write_modified_file(fname, new_fname, changes): | ||
| def write_modified_file(fname, new_fname, changes, encoding=None): |
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.
any changes required?
i guess the default value of write_modified_file is uncritical.
default value for cli option defaults to "utf-8" which will be passed on.
Yeap, I plan to come back to this and the other PR later this week. |
bsipocz
left a comment
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.
OK, this looks good to me. My only question is if we really need to add a new config option or reusing the existing doctest_encoding would be sufficient. Have you looked into that option? Obviously it only affects the adding a new parser option and not the actual code fixes where you added the usage of encoding.
bsipocz
left a comment
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.
Oh, and this will need a changelog entry, but I can deal with that at release time.
|
Hmm, failures look relevant for pytest < 7.4, but I haven't looked into the details. Possible options:
|
|
i use option whats confuses me i always run tox before a review, and i always pass all tests i guess there i just have to rewrite my tests to pass the configuration file in the correct way. dropping support should not be really necessary? |
|
ahh, indeeed. |
|
|
bsipocz
left a comment
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.
This all looks good now. Thank you @d-chris for your contribution and patience during the review process.
fixes #283
introduced option to specify file encoding when overwriting files.
default values
None"utf-8"command line option
configuration file