https://github.com/pypa/readme_renderer/pull/332 --- readme_renderer-44.0/tests/test_cli.py.orig +++ readme_renderer-44.0/tests/test_cli.py @@ -44,13 +44,14 @@ main(["no-file.invalid"]) -def test_cli_explicit_format(input_file): +def test_cli_explicit_format(input_file, tmp_path): fmt = input_file.suffix.lstrip(".") - with input_file.open() as fp, \ - mock.patch("pathlib.Path.open", return_value=fp), \ - mock.patch("builtins.print") as print_: - main(["-f", fmt, "no-file.invalid"]) - print_.assert_called_once() + + temp_input = tmp_path / "invalid.invalid" + temp_input.write_text(input_file.read_text()) + + with mock.patch("builtins.print") as print_: + main(["-f", fmt, str(temp_input)]) (result,), _ = print_.call_args with input_file.with_suffix(".html").open() as fp: