Open abravalheri opened 3 weeks ago
Since tmpdir
is a legacy API and there is already support for encoding
in write_text()
, I think it is unlikely this will change upstream.
LocalPath.open
and LocalPath.write_text
both support setting an encoding.
The only advantage of write
over write_text
, is that in non-b
mode it'll automatically stringify the data.
https://github.com/pytest-dev/pytest/blob/main/src/_pytest/_py/path.py#L903
So we have two paths forward:
write
for write_text
and add encoding where it's still missing.Either way, I've added a todo comment in https://github.com/pypa/setuptools/pull/4255
(note: small typos in issue title: "debit" --> "debt", and missing .
before "write")
In the last CI tests we can see the following warnings:
This seems to came from the fact that we are using
tmpdir.join(...)write(...)
. This method does not allow to specify theencoding
argument.We could replace it with
write_text(..., encoding="utf-8")
. However thetmpdir
fixture itself is deprecated, so another possibility would be moving totmp_dir
.Part of https://github.com/pypa/setuptools/issues/3810.