EncodingWarning must blame the read_text and open calls.
(self, alpharep)
| 189 | ) |
| 190 | @pass_alpharep |
| 191 | def test_encoding_warnings(self, alpharep): |
| 192 | """EncodingWarning must blame the read_text and open calls.""" |
| 193 | assert sys.flags.warn_default_encoding |
| 194 | root = zipfile.Path(alpharep) |
| 195 | with self.assertWarns(EncodingWarning) as wc: # noqa: F821 (astral-sh/ruff#13296) |
| 196 | root.joinpath("a.txt").read_text() |
| 197 | assert __file__ == wc.filename |
| 198 | with self.assertWarns(EncodingWarning) as wc: # noqa: F821 (astral-sh/ruff#13296) |
| 199 | root.joinpath("a.txt").open("r").close() |
| 200 | assert __file__ == wc.filename |
| 201 | |
| 202 | def test_open_write(self): |
| 203 | """ |
nothing calls this directly
no test coverage detected