pytest-dev / iniconfig

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Specify encoding explictly in the `IniConfig` constructor

inwaves opened this issue · comments

Hi!

Since Python 3.10 there's a new EncodeWarning that gets flagged when a file is opened without specifying an encoding. PR #10328 in pytest proposes adding this capability. For this to work, a bunch of calls need to be updated to explicitly specify encoding="utf-8" (or something similar – though UTF-8 seems like a sensible default).

Some of the tests, like test_ini_markers_whitespace, initialise an IniConfig object, whose constructor opens a file without specifying an encoding (see here). This leads to the test failing.

Can we modify the constructor to use an explicit encoding when opening the file? If iniconfig doesn't support UTF-8 we can just use ASCII – so long as something is specified.

Thanks!

@inwaves I think @RonnyPfannschmidt means that a PR in that sense would be welcome, if you want to contribute. 👍

@nicoddemus its actually on my todo for today ^^

Ahh sorry for assuming hehehe. 👍