pytest-dev / iniconfig

MIT License
53 stars 31 forks source link

Specify encoding explictly in the `IniConfig` constructor #48

Closed inwaves closed 1 year ago

inwaves commented 1 year ago

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!

RonnyPfannschmidt commented 1 year ago

we can

nicoddemus commented 1 year ago

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

RonnyPfannschmidt commented 1 year ago

@nicoddemus its actually on my todo for today ^^

nicoddemus commented 1 year ago

Ahh sorry for assuming hehehe. :+1: