introduced option to specify file encoding#284
introduced option to specify file encoding#284bsipocz merged 10 commits intoscientific-python:mainfrom
Conversation
pllim
left a comment
There was a problem hiding this comment.
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.
Should the default here be consistent with addoption default (utf-8)?
There was a problem hiding this comment.
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.
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.
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? |
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 |
|
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.
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.
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.
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. |
|
|
fixes #283
introduced option to specify file encoding when overwriting files.
default values
None"utf-8"command line option
configuration file