Skip to content

Specify encoding explictly in the IniConfig constructor #48

@inwaves

Description

@inwaves

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions