Skip to content

Commit

Permalink
specify encoding and linesep
Browse files Browse the repository at this point in the history
- fix: specify encoding and linesep
  • Loading branch information
msftcangoblowm committed Aug 29, 2024
1 parent 4267cb5 commit ad918b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,11 @@ def func(path_cwd):
# .git/config
# :code:`newline=None` auto translates \n --> os.linesep
try:
with open(str(path_git_config_dst), "a", newline=None) as f:
f_path = str(path_git_config_dst)
with open(f_path, mode="a", newline=os.linesep, encoding="utf-8") as f:
for additional_section_line in lines:
f.write(f"{additional_section_line}\n")
f.write(f"{additional_section_line}{os.linesep}")
f.write(os.linesep)
except OSError:
reason = "Could not rw .git/config"
pytest.xfail(reason)
Expand Down

0 comments on commit ad918b5

Please sign in to comment.